set.seed(1)
n <- 100
pts <- seq(0, 1, by=0.05)
sampWiener <- Wiener(n, pts)
sampWiener <- Sparsify(sampWiener, pts, 5:10)
res <- FPCA(sampWiener$Ly, sampWiener$Lt,
list(dataType='Sparse', error=FALSE, kernel='epan', verbose=TRUE))
fittedY <- fitted(res, ciOptns = list(alpha=0.05))
workGrid <- res$workGrid
cvgUpper <- fittedY$cvgUpper
cvgLower <- fittedY$cvgLower
op <- par(mfrow=c(2,3))
ind <- sample(1:n,6)
for (i in 1:6) {
j <- ind[i]
plot(workGrid,cvgUpper[j,],type='l',ylim=c(min(cvgLower[j,]),max(cvgUpper[j,])),col=4,lty=2,
xlab='t', ylab='X(t)', main=paste(j,'-th subject',sep=''))
points(workGrid,cvgLower[j,],type='l',col=4,lty=2)
points(res$inputData$Lt[[j]],res$inputData$Ly[[j]])
}
par(op)
Run the code above in your browser using DataLab