Learn R Programming

lqmix (version 1.2)

search_lqmix: Search the Global Maximum of a Linear Quantile Mixture

Description

Search the global maximum of the log-likelihood function for a finite mixture of linear quantile regression models with TC and/or TV, discrete, random coefficients, for varying number of components and/or states.

Usage

search_lqmix(formula, randomTC = NULL, randomTV = NULL, group, time,
  Gv = NULL, mv = NULL, data, method = "bic", nran = 0, qtl = 0.5,
  eps = 10^-5, maxit = 1000, se = TRUE, R = 200, verbose = TRUE,
  seed = NULL, parallel = FALSE, ncores = 2)

Value

Return an object of class

search_lqmix. This is a list containing the following elements:

optimal

the identified optimal model

allmodels

the output of each estimated model in the form of a list of lists; the former and the latter list are associated with TC and TV random coefficients, respectively

lkv

the vector of likelihood values for each fitted model

aicv

the vector of AIC values for each fitted model

bicv

the vector of BIC values for each fitted model

qtl

the estimated quantile

mv

the vector of possible number of states associated to TV random coefficients (if present)

Gv

the vector of possible number of mixture components associated to TC random coefficients (if present)

method

the method used to select the optimal model

call

the matched call

Arguments

formula

an object of class formula: a symbolic description of the model to be fitted

randomTC

a one-sided formula of the form ~z1+z2+...+zd, where z1,..., zd denote the variables associated to TC random coefficients (1 for the intercept)

randomTV

a one-sided formula of the form ~w1+w2+...+wl, where w1,..., wl denote the variables associated to TV random coefficients (1 for the intercept). Note that only TC variables are allowed

group

a string indicating the grouping variable, i.e., the factor identifying the unit longitudinal measurements refer to

time

a string indicating the time variable

Gv

vector of possible number of mixture components associated to TC random coefficients, if present in the model

mv

vector of possible number of states associated to the TV random coefficients, if present in the model

data

a data frame containing the variables named in formula, randomTC, randomTV, group, and time

method

method to use for selecting the optimal model. Possible values are "lk", "aic", or "bic"

nran

number of repetitions of each random initialization

qtl

quantile to be estimated

eps

tolerance level for convergence of the EM algorithm

maxit

maximum number of iterations for the EM algorithm

se

standard error computation for the optimal model

R

number of bootstrap samples for computing standard errors

verbose

if set to FALSE, no printed output is given during the function execution

seed

an integer value for random numbers generation, used for random parameter initialization and bootstrap standard errors

parallel

if set to TRUE, a parallelized code is use for standard error computation (if se = TRUE)

ncores

number of cores used for computing bootstrap standard errors (if required)

Details

The function allows to identify the optimal model specification in terms of number of mixture components and/or hidden states associated to TC and/or TV random coefficients, respectively. This is done by considering a multi-start strategy based on both deterministic and random starting points. The number or random starts is proportional to the number of mixture components and/or hidden states associated to the random coefficients in the model. For models based on TC random coefficients, nran x (G-1) random starts are considered; for models based on TV or TC and TV random coefficients, the number of random start is set to nran x (m-1) and nran x (G-1) x (m-1), respectively.

If method = "lk", the optimal model selected by the function is that providing the highest log-likelihood value; if method = "AIC", (method = "BIC", respectively), the optimal model selected by the function is that providing the lowest AIC (BIC, respectively) value.

If se=TRUE, standard errors based on a block bootstrap procedure are computed for the identified optimal model.

Examples

Run this code
sTC = search_lqmix(formula=meas~trt+time+trt:time,
                   randomTC=~1,group="id",time="time",Gv=1:3,method="bic",data=pain,se=FALSE)
# \donttest{
sTV = search_lqmix(formula=meas~trt+time+trt:time,
randomTV=~1,group="id",time="time",mv=1:3,method="bic",data=pain,se=FALSE)

sTCTV = search_lqmix(formula=meas~trt+time+trt:time,
randomTC=~time,randomTV=~1,group="id",time="time",mv=1:3,Gv=1:3,method="bic",data=pain,se=FALSE)
# }

Run the code above in your browser using DataLab