lqmix {lqmix} | R Documentation |
Linear Quantile Mixture with TC and/or TV, discrete, random coefficients
Description
Estimate a finite mixture of linear quantile regression models with TC and/or TV discrete random coefficients, for a given number of components and/or states
Usage
lqmix(formula, randomTC = NULL, randomTV = NULL, group, time, G = NULL,
m = NULL, data, qtl = 0.5, eps = 10^-5, maxit = 1000, se = TRUE,
R = 50, start = 0, parInit = list(betaf = NULL, betarTC = NULL, betarTV
= NULL, pg = NULL, delta = NULL, Gamma = NULL, scale = NULL),
verbose = TRUE, posterior = FALSE, seed = NULL, parallel = FALSE)
Arguments
formula |
an object of class |
randomTC |
a one-sided formula of the form |
randomTV |
a one-sided formula of the form |
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 |
G |
number of mixture components associated to TC random coefficients |
m |
number of states associated to the TV random coefficients |
data |
a data frame containing the variables named in |
qtl |
quantile to be estimated |
eps |
tolerance level for (relative) convergence of the EM algorithm |
maxit |
maximum number of iterations for the EM algorithm |
se |
if set to TRUE, standard error are computed |
R |
number of bootstrap samples for computing standard errors |
start |
type of starting values (0 = deterministic, 1 = random, 2 = initial values in input) |
parInit |
list of initial model parameters when |
verbose |
if set to FALSE, no printed output is given during the function execution |
posterior |
if set to TRUE, posterior probabilities are given in output |
seed |
an integer value for random numbers generation |
parallel |
if set to TRUE, a parallelized code is use for standard error computation (if se=TRUE) |
Details
The function computes ML estimates for a linear quantile mixture model with on TC and/or TV random coefficients. Estimates are derived by maximizing the (log-)likelihood of an asymmetric Laplace regression, where the location parameter is modeled as a function of fixed coefficients, together with TC, TV, or TC and TV discrete random coefficients, as proposed by Alfo' et. al (2017), Farcomeni (2012), and Marino et. al (2018), respectively.
The function requires data in long-format and two additional columns indicating the group identifier and the time occasion.
The model is specified by means of the arguments formula
, formulaTC
, and formulaTV
:
formula
is associated to fixed coefficients; formulaTC
is associated to TC random coefficients; formulaTV
is associated to TV random coefficients.
In this latter, only TC variables (predictors) are allowed.
The function allows for missing data, including dropouts (monotone missing data) and intermittent missingness, under a missing-at-random assumption. Note that, when TV random coefficients are considered, intermittent missingness may cause biased inference.
If se=TRUE
, standard errors based on a block bootstrap procedure are computed.
Value
Return an object of class
lqmix
. This is a list containing the following elements:
betaf |
a vector containing fixed regression coefficients |
betarTC |
a matrix containing the TC random coefficients, if present in the model |
betarTV |
a matrix containing the TV random coefficients, if present in the model |
pg |
the prior probabilities of the finite mixture associated to TC random coefficients, if present in the model |
delta |
the initial probability vector of the hidden Markov chain associated to TV random coefficients, if present in the model |
Gamma |
the transition probability matrix of the hidden Markov chain associated to TV random coefficients, if present in the model |
scale |
the scale parameter |
sigma.e |
the standard deviation of error terms |
lk |
the log-likelihood at convergence of the EM algorithm |
npar |
the total number of model parameters |
aic |
the AIC value |
bic |
the BIC value |
qtl |
the estimated quantile |
G |
the number of mixture components associated to TC random coefficients (if present) |
m |
the number of hidden states associated to TV random coefficients (if present) |
nsbjs |
the number of subjects |
nobs |
the total number of observations |
se.betaf |
the standard errors for fixed regression coefficients |
se.betarTC |
the standard errors for TC random coefficients (if present) |
se.betarTV |
the standard errors for TV random coefficients (if present) |
se.Mprob |
the standard errors for the prior probabilities of the finite mixture associated to TC random coefficients (if present) |
se.Init |
the standard errors for the initial probabilities of the hidden Markov chain associated to TV random coefficients(if present) |
se.Trans |
the standard errors for the transition probabilities of the hidden Markov chain associated to TV random coefficients (if present) |
se.scale |
the standard error for the scale parameter |
postTC |
estimated posterior probabilities for the finite mixture components associated to TC random coefficients |
postTV |
estimated posterior probabilities for the hidden states associated to TV random coefficients |
miss |
the missingness type |
model |
the estimated model |
call |
the matched call |
References
Marino MF, Tzavidis N, Alfo' M (2018). “Mixed hidden Markov quantile regression models for longitudinal data with possibly incomplete sequences.” Statistical Methods in Medical Research, 27, 2231-2246.
Altman RJ (2007). “Mixed hidden Markov models: an extension of the hidden Markov model to the longitudinal data setting.” Journal of the American Statistical Association, 102, 201–210.
Maruotti A (2011). “Mixed Hidden Markov Models for Longitudinal Data: An Overview.” International Statistical Review, 79. ISSN 1751-5823.
Examples
outTC = lqmix(formula=meas~trt+time+trt:time,randomTC=~1,
group="id",time="time",G=2,data=pain,se=TRUE,R=10)
outTV = lqmix(formula=meas~trt+time+trt:time,randomTV=~1,
group="id",time="time",m=2,data=pain,R=10)
outTCTV = lqmix(formula=meas~trt+time+trt:time,randomTC=~time,
randomTV=~1,group="id",time="time",m=2,G=2,data=pain,R=10)