rcpme: Random Change Point Mixed Model

View source: R/rcpme.R

rcpmeR Documentation

Random Change Point Mixed Model

Description

Random Change Point Mixed Model

Usage

rcpme(
  longdata,
  formu,
  covariate = "NULL",
  REadjust = "no",
  gamma = 0.1,
  nbnodes = 10,
  param = NULL,
  model = "test",
  link = "linear",
  statut = NULL,
  latent = FALSE,
  classprob = NULL
)

Arguments

longdata

A longitudinal dataset containing all variables used in the formula formu

formu

A formula object describing which variables are to be used. The formula has to be of the following form markervar ~ scorevar | groupvar for the function to work.

covariate

An optional string indicating a binary covariate to add on the fixed effects, i.e. intercept, mean slope, difference of slopes and changepoint date. The parameter REadjust indicates how this covariate influences the random effects variance structure. Default to NULL, i.e. no covariates.

REadjust

An optional string value indicating how the random effects variance structure depends on covariate. "no" means that the structure doesn't depend upon covariate. "prop" indicates that the random effects variance structure is proportional according to covariate value. "yes" indicates that there is two different random effects variance structures, i.e. one for each level of covariate. Default to "no".

gamma

A numeric parameter indicating how smooth the trajectory is on the changepoint date. It should be small according to the time variable scale. Default to 0.1.

nbnodes

A numeric parameter indicating how many nodes are to be used for the gaussian quadrature for numerical integration. Default to 10.

param

An optional vector parameter that contains initial parameter for the optimization of the log-likelihood. Default to NULL.

model

An optional string indicating which formulation of the random changepoint exists. The first model, 'test', is Y_ij = \beta_{0i} + \beta_{1i}t_{ij} + \beta_{2i}\sqrt{(t_{ij}-\tau_i)^2+\gamma} + \epsilon_{ij} used by the 'testRCPMM' function. The second is 'bw' for the Bacon-Watts formulation of the model Y_ij = \beta_{0i} + \beta_{1i}(t_{ij}-\tau_i) + \beta_{2i}\sqrt{(t_{ij}-\tau_i)^2+\gamma} + \epsilon_{ij}. The third option is 'isplines' for the I-spline model. When used for estimation purpose, you should either 'bw' or 'isplines' which has clear interpretability properties. Default to 'bw'

link

An optional string indicating which link function is to be used. This link function is used to deal with non-gaussian data. With 'link=splines' the model estimates an appropriate I-spline link function 'g' so that 'g(scorevar)' is a gaussian variable. If data is already gaussian, you can chose 'link=linear' so that no link function will be estimated. Default to 'linear'.

statut

An optional string indicating a binary variable from which two class are considered: a linear class for subjects with statut=0 and a random changepoint class for subjects with statut=1. Default to NULL.

Value

The output contains several objects : call is the function call; loglik is the value of the log-likelihood at the optimum; formula is the formula describing which variables are used in the model; fixed contains all fixed parameters estimates, standard errors, CIs, wald test statistic and corresponding pvalue when possible; sdres the estimated residual error; VarEA a 4x4 matrix or a list of 4x4 matrices - if there is some covariate for example - containing the estimated random effects covariance matrix; optpar the optimal parameters maximizing the log-likelihood; covariate the covariate declared in the function call; REadjust the string indicating how random effects structure is handled as declared in the function call, invhessian the covariance matrix containing all the standard errors and correlations of the parameter estimates; conv an index of successful convergance, equals to 1 if success; init the initial values vector; model the model used during estimation; gamma the value of gamma used during estimation; link the link function used during estimation.


crsgls/rcpm documentation built on Sept. 28, 2024, 11:38 a.m.