predict.SMNclmm | R Documentation |
Predicted values are obtained through conditional expectation. For details, see Schumacher, Lachos, and Matos (2021).
## S3 method for class 'SMNclmm'
predict(object, newData, ...)
object |
An object inheriting from class |
newData |
A data frame for which response variable should be predicted, including covariates, groupVar and possibly timeVar. If missing or |
... |
Additional arguments. |
A data frame with covariates, groupVar and ypred, where ypred contains the predicted values from the response variable.
Fernanda L. Schumacher, Larissa A. Matos, Victor H. Lachos and Katherine L. Valeriano
Schumacher, F. L., Lachos, V. H., and Matos, L. A. (2021). Scale mixture of skew-normal linear mixed models with within-subject serial dependence. Statistics in Medicine 40(7), 1790-1810.
smn.clmm
, fitted.SMNclmm
# Simulated example: 20 individuals with 5 times for estimation and
# 1 time for prediction
set.seed(963)
nj1 = 6; m = 20
time = rep(1:nj1, times=m)
groups = as.factor(rep(1:m, each=nj1))
dat1 = rsmsn.clmm(time, groups, cbind(1,time), rep(1,m*nj1), sigma2=0.4,
D=0.6*diag(1), beta=c(1,2), depStruct="CS", phi=0.25)
# Estimation
fm1 = smn.clmm(subset(dat1,time<6), formFixed=y~x, groupVar="ind",
depStruct="CS", ci="ci", lcl="lcl", ucl="ucl",
control=lmmControl(max.iter=30, tol=1e-4))
# Prediction
pred = predict(fm1, subset(dat1,time==6))
# MSPE
mean((subset(dat1,time==6)$y - pred$ypred)^2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.