For `hlme`

and `Jointlcmm`

objects, the function computes the predicted values of the longitudinal marker in each latent class for a specified profile of covariates.
For `lcmm`

and `multlcmm`

objects, the function computes predicted values in the natural scale of the outcomes for a specified profile of covariates. For linear and threshold links, the predicted values are computed analytically. For splines and Beta links, a Gauss-Hermite or Monte-Carlo integration are used to numerically compute the predictions. In addition, for any type of link function, confidence bands (and median) can be computed by a Monte Carlo approximation of the posterior distribution of the predicted values.

1 2 3 4 5 6 7 8 9 10 11 | ```
## S3 method for class 'lcmm'
predictY(x,newdata,var.time,methInteg=0,nsim=20,draws=FALSE,
ndraws=2000,na.action=1,...)
## S3 method for class 'hlme'
predictY(x,newdata,var.time,draws=FALSE,na.action=1,...)
## S3 method for class 'Jointlcmm'
predictY(x,newdata,var.time,methInteg=0,nsim=20,draws=FALSE,
ndraws=2000,na.action=1,...)
## S3 method for class 'multlcmm'
predictY(x,newdata,var.time,methInteg=0,nsim=20,draws=FALSE,
ndraws=2000,na.action=1,...)
``` |

`x` |
an object inheriting from class |

`newdata` |
data frame containing the data from which predictions are computed. The data frame should include at least all the covariates listed in x$Xnames2. Names in the data frame should be exactly x$Xnames2 that are the names of covariates specified in |

`var.time` |
A character string containing the name of the variable that corresponds to time in the data frame (x axis in the plot). |

`methInteg` |
optional integer specifying the type of numerical integration required only for predictions with splines or Beta link functions. Value 0 (by default) specifies a Gauss-Hermite integration which is very rapid but neglects the correlation between the predicted values (in presence of random-effects). Value 1 refers to a Monte-Carlo integration which is slower but correctly account for the correlation between the predicted values. |

`nsim` |
For a |

`draws` |
optional boolean specifying whether median and confidence bands of the predicted values should be computed (TRUE) - whatever the type of link function. For a |

`ndraws` |
For a |

`na.action` |
Integer indicating how NAs are managed. The default is 1 for 'na.omit'. The alternative is 2 for 'na.fail'. Other options such as 'na.pass' or 'na.exclude' are not implemented in the current version. |

`...` |
further arguments to be passed to or from other methods. They are ignored in this function. |

An object of class `predictY`

with values :

- `pred`

: a matrix with the same rows (number and order) as in
newdata.

For `hlme`

objects and `lcmm`

or `Jointlcmm`

with `draws=FALSE`

, returns a matrix with ng columns corresponding to the ng class-specific vectors of predicted values computed at the point estimate

For objects of class `lcmm`

or `Jointlcmm`

with `draws=TRUE`

, returns a matrix with ng*3 columns representing the ng class-specific 50%, 2.5% and 97.5% percentiles of the approximated posterior distribution of the class-specific predicted values.

For objects of class `multlcmm`

with `draws=FALSE`

, returns a matrix with ng+1 columns: the first column indicates the name of the outcome which is predicted and the ng subsequent columns correspond to the ng class-specific vectors of predicted values computed at the point estimate

For objects of class `multlcmm`

with `draws=TRUE`

, returns a matrix with ng*3+1 columns: the first column indicates the name of the outcome which is predicted and the ng*3 subsequent columns correspond to the ng class-specific 50%, 2.5% and 97.5% percentiles of the approximated posterior distribution of the class-specific predicted values.

- `times`

: the `var.time`

variable from `newdata`

Cecile Proust-Lima, Viviane Philipps

`lcmm`

, `multlcmm`

, `hlme`

, `Jointlcmm`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ```
#### Prediction from a 2-class model with a Splines link function
## Not run:
## fitted model
m<-lcmm(Ydep2~Time*X1,mixture=~Time,random=~Time,classmb=~X2+X3,
subject='ID',ng=2,data=data_lcmm,link="splines",B=c(
-0.175, -0.191, 0.654, -0.443,
-0.345, -1.780, 0.913, 0.016,
0.389, 0.028, 0.083, -7.349,
0.722, 0.770, 1.376, 1.653,
1.640, 1.285))
summary(m)
## predictions for times from 0 to 5 for X1=0
newdata<-data.frame(Time=seq(0,5,length=100),
X1=rep(0,100),X2=rep(0,100),X3=rep(0,100))
pred0 <- predictY(m,newdata,var.time="Time")
head(pred0)
## Option draws=TRUE to compute a MonteCarlo
# approximation of the predicted value distribution
# (quite long with ndraws=2000 by default)
\dontrun{
pred0MC <- predictY(m,newdata,draws=TRUE,var.time="Time")
}
## predictions for times from 0 to 5 for X1=1
newdata$X1 <- 1
pred1 <- predictY(m,newdata,var.time="Time")
## Option draws=TRUE to compute a MonteCarlo
# approximation of the predicted value distribution
# (quite long with ndraws=2000 by default)
\dontrun{
pred1MC <- predictY(m,newdata,draws=TRUE,var.time="Time")
}
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.