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])) 
}
+   trans
+ }

> trans_dt(dp1,ahall,bhall)
Error in transform(dti, newdt = pgamma(dti, shape = a[1, i], scale = b[1,  : 
  object "dti" not found

and also try 
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)
  {  dti <- dt[,i]
     ai  <- a[1,i]
     bi  <- b[1,i]
     trans[,i] <- transform(dti,newdt=pgamma(dti,shape= ai,scale=bi)) }
  trans
}

trans_dt(dp1,ahall,bhall)
Error in pgamma(dti, shape = ai, scale = bi) : object "dti" not found


Thank you for any help given.


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to