lsmm | R Documentation |
This function fits complex mixed effects model with a time and covariate dependent variance. We suppose that the variance of the residual error is time-dependent and subject-specific. Parameters are estimated simultaneously through a maximum likelihood method, using a Marquardt-Levenberg algorithm.
lsmm(
formFixed,
formRandom,
formGroup,
timeVar,
data.long,
variability_hetero = TRUE,
formFixedVar,
formRandomVar,
correlated_re = FALSE,
S1 = 1000,
S2 = 5000,
nproc = 1,
clustertype = "SOCK",
maxiter = 100,
print.info = FALSE,
file = NULL,
epsa = 0.001,
epsb = 0.001,
epsd = 0.001,
binit = NULL
)
formFixed |
A formula for the fixed effects of the longitudinal submodel |
formRandom |
A formula for the random effects of the longitudinal submodel |
formGroup |
A formula which indicates the group variable |
timeVar |
The name of the column of time in data.long. This variable must appears in data.long |
data.long |
A dataframe with the longitudinal data |
variability_hetero |
A logical to indicate if we suppose a subject_specific variability |
formFixedVar |
A formula for the fixed effects of the variance predictor |
formRandomVar |
A formula for the random effects of the variance predictor |
correlated_re |
A logical to indicate if the random effects of the marker and the variance predictors are correlated (By default there are supposed to be independent) |
S1 |
An integer : the number of QMC draws for the first step |
S2 |
An integer : the number of QMC draws for the second step |
nproc |
An integer : the number of processors for parallel computing |
clustertype |
one of the supported types from |
maxiter |
optional maximum number of iterations for the marqLevAlg iterative algorithm. |
print.info |
logical indicating if the outputs of each iteration should be written |
file |
optional character giving the name of the file where the outputs of each iteration should be written (if print.info=TRUE) |
epsa |
optional threshold for the convergence criterion based on the parameter stability. |
epsb |
optional threshold for the convergence criterion based on the objective function stability. |
epsd |
optional threshold for the relative distance to maximum. This criterion has the nice interpretation of estimating the ratio of the approximation error over the statistical error, thus it can be used for stopping the iterative process whatever the problem. |
binit |
optional initials parameters. |
The model is defined by :
#' \quad\left\{\begin{array}{ll}
Y_{ij} = Y_{i}(t_{ij}) = \widetilde{Y}_i(t_{ij}) + \epsilon_{ij} = X_{ij}^{\top} \beta+Z_{ij}^{\top} b_{i}+\epsilon_{ij}, \\
\epsilon_{ij}(t_{ij}) \sim \mathcal{N}(0,\sigma_i^2(t_{ij})) \hspace{3mm} \text{with} \hspace{3mm} \log(\sigma_i(t_{ij})) = O_{ij}^{\top} \mu+M_{ij}^{\top} \tau_{i}
\end{array}
\right.
X_{ij}
, O_{ij}
, Z_{ij}
and M_{ij}
four vectors of explanatory variables for subject i
at visit j
,
respectively associated with the fixed-effect vectors \beta
and \mu
, and the subject-specific random-effect vector b_i
and \tau_i
, such as
\quad\left(\begin{array}{c}
b_{i} \\
\tau_i
\end{array}\right) \sim N\left(\left(\begin{array}{c}
0 \\
0
\end{array}\right),\left(\begin{array}{cc}
\Sigma_{b} & \Sigma_{\tau b} \\
\Sigma_{\tau b}' & \Sigma_{\tau}
\end{array}\right)\right)
Y_{i}(t_{ij}) = \tilde{Y}_i(t_{ij}) + \epsilon_{ij} = X_{ij}^{\top} \beta+Z_{ij}^{\top} b_{i}+\epsilon_{ij}
with X_{ij}
and Z_{ij}
two covariate vectors for subject i at visit j,
respectively associated with the vector of fixed effects \beta
and the vector of
subject-specific individual random effects b_i
.
The vector b_i
is assumed to be normally distributed and a specific-subject random effect on the
variance of the measure error can be added: \epsilon_{ij} \sim \mathcal{N}(0,\sigma_i^2)
and
\quad\left(\begin{array}{c}
b_{i} \\
\log \sigma_{i}
\end{array}\right) \sim \mathcal{N}\left(\left(\begin{array}{c}
0 \\
\mu_{\sigma}
\end{array}\right),\left(\begin{array}{cc}
\Sigma_{b} & 0 \\
0 & \tau_{\sigma}^{2}
\end{array}\right)\right)
A FlexVarJoint object which contains the following elements :
result
A marqLevAlg object with the results of the estimation.
table.res
The table of results : Estimation and SE
time.compute
Computation time
control
A list of control elements
#fit a joint model with competing risks and subject-specific variability
example <- lsmm(formFixed = y~visit,
formRandom = ~ visit,
formGroup = ~ID,
timeVar = "visit",
data.long = Data_toy,
variability_hetero = TRUE,
formFixedVar =~visit,
formRandomVar =~visit,
correlated_re = TRUE,
S1 = 100,
S2 = 1000,
nproc = 1,
maxiter = 100
)
summary(example)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.