data(data.simulation)
fpca <- uni.fpca(Y = DST$obs, Y.pred=DSV$obs)
# visualize the data and predicted surface
par(mfrow = c(1,2))
persp(DSV$cp, DSV$tp, DSV$obs, theta=60, phi=15,
ticktype = "detailed", col="lightblue",
xlab = "covariate", ylab = "time",
zlab="data", main="data surface (partically observed)")
persp(DSV$cp, DSV$tp, fpca$Yhat, theta=60, phi=15,
ticktype = "detailed", col="lightblue",
xlab = "covariate", ylab = "time",
zlab="data", main="predicted surface via univariate FPCA")
# predication error
mean(((fpca$Yhat - DSV$obs.full)[!is.na(DSV$obs)])^2)
Run the code above in your browser using DataLab