Displaying 2 results from an estimated 2 matches for "trans_dt".
Did you mean:
trans3d
2009 May 07
1
data transformation using gamma
Hi R-users,
I have this code to uniformise the data using gamma:
> length(dp1)
[1] 696
> dim(dp1)
[1] 58 12
> dim(ahall)
[1] 1 12
> dim(bhall)
[1] 1 12
> trans_dt <- function(dt,a,b)
+ { n1 <- ncol(dt)
+ n2 <- length(dt)
+ trans <- vector(mode='numeric', length=n2)
+ dim(trans) <- dim(dt)
+ for (i in 1:n1)
+ { dt[,i] <- as.vector(dt[,i])
+ trans[,i] <- transform(dti,newdt=pgamma(dti,shape= a[1,i],scale=b[1,i]))...
2009 May 01
0
need help - small code
...56,] 1.4 43.4 52.4 72.2 126.8 66.8 101.6 144.2 82.2 85.0 37.4 55.4
[57,] 167.4 194.0 17.4 38.0 9.2 11.6 110.2 126.4 68.8 74.0 9.2 18.2
[58,] 11.4 8.2 46.6 49.6 84.2 68.2 48.6 160.6 31.6 94.8 62.6 67.6
I try to write this code and try run it but got error message:
trans_dt <- function(dt,a,b)
{ trans <- vector(length=12, mode="numeric")
n <- ncol(dt)
for (i in 1:n)
{ trans[i] <- transform(dt[,i],newdt=pgamma(dt[,i],shape= a[1,i],scale=b[1,i])) }
trans
}
> trans_dt(dp1,ahall,bhall)
Error in pgamma(dt[, i], shape = a[1, i], scale =...