[R] Help needed!

Shuangyan Xiong shx6 at pitt.edu
Wed Apr 20 23:33:40 CEST 2011


Hi everyone,

I have a question. Now I am reading the resource code of the package 
"ssfcov". The resource code is as following. I cannot find the resource 
code of the function "myss2d" anywhere in the package. Can anyone give 
me a hint how to find it in the package. Thanks a lot!!bv


 > ssfcov
function (time, x, subject, nbasis = 5, centered = FALSE, noDiag = TRUE)
{
     if (!centered) {
         fit <- smooth.spline(time, x)
         x <- x - fitted(fit)
     }
     gg <- NULL
     for (zz in unique(subject)) {
         if (sum(subject == zz) > 1) {
             tt <- time[subject == zz]
             xx <- x[subject == zz]
             g <- expand.grid(t1 = tt, t2 = tt)
             scov <- xx %*% t(xx)
             if (noDiag)
                 scov <- scov + diag(rep(Inf, length(xx)))
             g$z <- matrix(scov, ncol = 1)
             gg <- rbind(gg, g[g$z < Inf, ])
         }
     }
     nobs <- nrow(gg)
     tt <- min(time) + (max(time) - min(time)) * (1:nbasis)/(nbasis +
         1)
     g <- expand.grid(t1 = tt, t2 = tt)
     g$z <- 0
     gg <- rbind(gg, g)
     fit <- myss2d(z ~ t1 * t2, data = gg, id.basis = ((nobs +
         1):(nobs + nbasis * nbasis)))
     class(fit) <- "rfcovObj"
     return(fit)
}
<environment: namespace:ssfcov>


Best,
Shuangyan
 >



More information about the R-help mailing list