Predictions (marginal and possibly subject-specific in some cases) of a hlme
,
lcmm
, multlcmm
or Jointlcmm
object in the natural scale
of the longitudinal outcome(s) computed from a profile of covariates (marginal) or
individual data (subject specific in case of hlme
).
Source: R/predictY.Jointlcmm.R
, R/predictY.hlme.R
, R/predictY.lcmm.R
, and 1 more
predictY.Rd
For hlme
and Jointlcmm
objects, the function computes the
predicted values of the longitudinal marker (in each latent class of ng>1) 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.
Usage
# S3 method for Jointlcmm
predictY(
x,
newdata,
var.time,
methInteg = 0,
nsim = 20,
draws = FALSE,
ndraws = 2000,
na.action = 1,
...
)
# S3 method for hlme
predictY(
x,
newdata,
var.time,
draws = FALSE,
na.action = 1,
marg = TRUE,
subject = NULL,
...
)
# S3 method for lcmm
predictY(
x,
newdata,
var.time,
methInteg = 0,
nsim = 20,
draws = FALSE,
ndraws = 2000,
na.action = 1,
...
)
predictY(x, newdata, var.time, ...)
# S3 method for multlcmm
predictY(
x,
newdata,
var.time,
methInteg = 0,
nsim = 20,
draws = FALSE,
ndraws = 2000,
na.action = 1,
...
)
Arguments
- x
an object inheriting from class
lcmm
,hlme
,Jointlcmm
ormultlcmm
representing a general latent class mixed model.- newdata
data frame containing the data from which predictions are to be 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
lcmm
,hlme
,Jointlcmm
ormultlcmm
calls. Forhlme
object and marg=FALSE, the grouping structure and values for the outcome should also be specified.- 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
lcmm
,multlcmm
orJointlcmm
object only; optional number of points used in the numerical integration with splines or Beta link functions. For methInteg=0, nsim should be chosen among the following values: 5, 7, 9, 15, 20, 30, 40 or 50 (nsim=20 by default). If methInteg=1, nsim should be relatively important (more than 200).- 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
lcmm
,multlcmm
orJointlcmm
object, a Monte Carlo approximation of the posterior distribution of the predicted values is computed and the median, 2.5% and 97.5% percentiles are given. Otherwise, the predicted values are computed at the point estimate. By default, draws=FALSE.- ndraws
For a
lcmm
,multlcmm
orJointlcmm
object only; if draws=TRUE, ndraws specifies the number of draws that should be generated to approximate the posterior distribution of the predicted values. By default, ndraws=2000.- 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. Only the argument 'median' will be used, other are ignored. 'median' should be a logical indicating whether the median should be computed. By default, the mean value is computed.
- marg
Optional boolean specifying whether the predictions are marginal (the default) or subject-specific (marg=FALSE). marge=FALSE only works with
hlme
objects.- subject
For a
hlme
object with marg=FALSE only, character specifying the name of the grouping strucuture. If NULL (the default), the same as in the model (argument x) will be used.
Value
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.
For objects of class hlme
with marg=FALSE
, returns a matrix
with 2+ng columns : the grouping structure, subject-specific predictions (pred_ss) averaged
over classes and the class-specific subject-specific predictions (with the
number of the latent class: pred_ss_1,pred_ss_2,...)
- times
: the var.time
variable from newdata