data(data.simulation) # load benchmark data
y <- DST$obs # matrix of observation
tp <- DST$tp; cp <- DST$cp
# fixed number of knots
# bivariate for mean and variance, univrariate for shape
nknots.tp <- c(2,2,2)
nknots.cp <- c(2,2)
## Not run:
# fit.cSFM <- cSFM.est(y, tp, cp, nknots.tp, nknots.cp, method = "cSFM")
# fit.cSFM #print out the results briefly
# # fitted mean, logvar and skewness; fitted quantiles
# fitted.value <- fitted(fit.cSFM)
#
# # visualize the parameter function and the estimated function
# par(mfrow = c(1,2))
# persp(DST$cp, DST$tp, DST$pars$mean, theta=60, phi=15,
# ticktype = "detailed", col="lightblue",
# xlab = "covariate", ylab = "time",
# zlab="data", main="parameter surface")
# persp(DST$cp, DST$tp, fit.cSFM$cp.hat$mean, theta=60, phi=15,
# ticktype = "detailed", col="lightblue",
# xlab = "covariate", ylab = "time",
# zlab="data", main="estimated surface via 'cSFM' method")
#
# # predication for missing data
# y.valid <- DSV$obs # matrix of training data; include missing values
# tp.valid <- DSV$tp; cp.valid <- DSV$cp
# #predication for training data
# yhat.predict <- predict(fit.cSFM, y.valid, cp.valid, tp.valid)
#
# # visualize the data and predicted surface
# par(mfrow = c(1,2))
# persp(DSV$cp, DSV$tp, y.valid, theta=60, phi=15,
# ticktype = "detailed", col="lightblue",
# xlab = "covariate", ylab = "time",
# zlab="data", main="data surface (partically observed)")
#
# persp(DSV$cp, DSV$tp, yhat.predict, theta=60, phi=15,
# ticktype = "detailed", col="lightblue",
# xlab = "covariate", ylab = "time",
# zlab="data", main="predicted surface via 'cSFM' method")
#
# # predication error
# mean(((yhat.predict - DSV$obs.full)[!is.na(DSV$obs)])^2)
# ## End(Not run)
Run the code above in your browser using DataLab