# trajeR: Fitting longitudinal mixture models In trajeR: Group Based Modeling Trajectory

 trajeR R Documentation

## Fitting longitudinal mixture models

### Description

`trajeR` is used to fit longitudinal mixture models. It used 3 types of mixture models : LOGIT, ZIP and censored Normal.

### Usage

```trajeR(
Y,
A,
Risk = NULL,
TCOV = NULL,
degre = NULL,
degre.nu = 0,
degre.phi = 0,
Model,
Method = "L",
ssigma = FALSE,
ymax = max(Y, na.rm = TRUE) + 1,
ymin = min(Y, na.rm = TRUE) - 1,
hessian = TRUE,
itermax = 100,
paraminit = NULL,
ProbIRLS = TRUE,
refgr = 1,
fct = NULL,
diffct = NULL,
nbvar = NULL,
ng.nl = NULL,
nls.lmiter = 50
)
```

### Arguments

 `Y` Matrix. A matrix containing the variables in the model. `A` Matrix. A matrix containing the time variable data. `Risk` Matrix. An optional matrix that modify the probability of belong to group. By default its value is a matrix with one column with value 1. `TCOV` Matrix. An optional matrix containing the time covariate that influence the trajectory themselves. By default its value is NULL. `degre` Vector of integer. The degree of every polynomial function. `degre.nu` Vector of integer. The degree of all Poisson part for a ZIP model. `degre.phi` Vector of integer. The degree of beta parametr for a BETA model. `Model` String. The model used. The value are LOGIT for a Logit Mixture model, CNORM for a Censored Normal Mixture Model or ZIP for Zero Inflated Poisson Mixture model. `Method` String. Determine the method used for find the parameters of the model. The value are L for the Maximum Likelihood Estimation, EM for Expectation Maximization method with quasi newton method inside, EMIWRLS for Expectation Maximization method with Iterative Weighted Least Square. `ssigma` Logical. By default its value is FALSE. For the CNORM model, indicate if we want the same sigma for all normal density function. `ymax` Real. For the CNORM model, indicate the maximum value of the data. It concern only the model with censored data. By default its value is the maximum value of the data plus 1. `ymin` Real. For the CNORM model, indicate the minimum value of the data. It concern only the model with censored data. By default its value is the maximum value of the data minus 1. `hessian` Logical. Indicate if we want calculate the hessian matrix. Default is FALSE. If the method use is Likelihood, the hessian is calculated by inverting the Information's Fisher Matrix. To avoid numerically singular matrix we find the pseudo inverse matrix by using the `ginv` function int he package MASS. If the method is EM or EMIWRLS, the hessian is calculated by using Louis method. `itermax` Integer. Indicate the maximal number of iteration for `optim` function or for the EM algorithm. `paraminit` Vector. The vector of initial parameters. By default `trajeR` calculate the initial value based of the range or the standard deviation. `ProbIRLS` Logical. Indicate the method to sue in the search of predictor's probability. If TRUE (by default) we use IRLS method and if FALSE we use optimization method. `refgr` Integer. The number of reference group. By default is 1. `fct` Function. The definition of the function f in the definition in nonlinear model. `diffct` Function. The differential of the function f in the nonlinear model. `nbvar` Integer. The number of variable in the nonlinear model. `ng.nl` Integer. The number of group for a non linear model. `nls.lmiter` Integer. In the case of non linear model, the maximum number of iterations allowed.

### Details

Models for trajeR is, by default, a polynomial regression of the time value parameters for each groups. The number fo group is controlled by the integer `ng`. We can spcecify the degre of the polynomial shape for each groups by the vector `degre`.

### Value

return an object of class "`Trajectory.LOGIT`". The generic accessor functions `beta`, `delta`, `theta`, `sd`, `tab`, `Likelihood`, `ng`, `model` and `method` extract various useful features of the value returned by `trajeR`.

An object of class "`Trajectory.LOGIT`" is a list containing at least the following components:

`beta`

a vector of the parameters beta.

`delta`

a vector of the parameter delta. Only if we use time covariate.

`theta`

a vector with the parameter theta if there exist a covariate X that modify the probability or the probability of group membership.

`sd`

a vector of the standrad deviation of the parameters.

`tab`

a matrix with all the parameters and standard deviation.

`Likelihood`

a real with the Likelihhod obtnaied by the parameters.

`ng`

a integer with the number of group.

`model`

a string with the model used.

`method`

a string with the method used.

### Examples

```## Not run: