Learn R Programming

qrLMM (version 1.1)

QRLMM: Quantile Regression for Linear Mixed-Effects Models

Description

Performs a quantile regression for a LMEM using the Stochastic-Approximation of the EM Algorithm (SAEM) for an unique or a set of quantiles.

Usage

QRLMM(y,x,z,nj,p=0.5,precision=0.0001,MaxIter=300,M=10,cp=0.25, beta=NA,sigma=NA,Psi=NA,show.convergence=TRUE,CI=95)

Arguments

y
the response vector of dimension $N$ where $N$ is the total of observations.
x
design matrix for the fixed effects of dimension $N x d$ where $d$ represents the number of fixed effects including the intercept, if considered.
z
design matrix for the random effects of dimension $N x q$ where $q$ represents the number of random effects.
nj
Vector of dimension $n$ containing the number of observations per subject. Must sum $N$.
p
unique quantile or a set of quantiles related to the quantile regression.
precision
the convergence maximum error.
MaxIter
the maximum number of iterations of the SAEM algorithm. Default = 300.
M
Number of Monte Carlo simulations used by the SAEM Algorithm. Default = 10. For more accuracy we suggest to use M=20.
cp
cut point $(0 \le cp \le 1)$ which determines the percentage of initial iterations with no memory.
beta
fixed effects vector of initial parameters, if desired.
sigma
dispersion initial parameter for the error term, if desired.
Psi
Variance-covariance random effects matrix of initial parameters, if desired.
show.convergence
if TRUE, it will show a graphical summary for the convergence of the estimates of all parameters for each quantile in order to assess the convergence.
CI
Confidence to be used for the Confidence Interval when a grid of quantiles is provided. Default=95.

Value

The function returns a list with two objects
conv
A two elements list with the matrices teta and se containing the point estimates and standard error estimate for all parameters along all iterations.
The second element of the list is res, a list of 12 elements detailed as
iter
number of iterations.
criteria
attained criteria value.
beta
fixed effects estimates.
sigma
scale parameter estimate for the error term.
Psi
Random effects variance-covariance estimate matrix.
SE
Standard Error estimates.
table
Table containing the inference for the fixed effects parameters.
loglik
Log-likelihood value.
AIC
Akaike information criterion.
BIC
Bayesian information criterion.
HQ
Hannan-Quinn information criterion.
time
processing time.

Details

This algorithm performs the SAEM algorithm proposed by Delyon et al. (1999), a stochastic version of the usual EM Algorithm deriving exact maximum likelihood estimates of the fixed-effects and variance components.

If the initial parameters are not provided, by default, the fixed effects parameter $\beta$ and dispersion parameter $\sigma$ will be the maximum Likelihood Estimates for an Asymmetric Laplace Distribution (obviating the random term). See Yu & Zhang (2005).

When a grid of quantiles is provided, a graphical summary with point estimates and Confidence Intervals for model parameters is shown and also a graphical summary for the convergence of these estimates (for each quantile), if show.convergence=TRUE.

If the convergence graphical summary shows that convergence has not be attained, it's suggested to increase M to 20, to increase the total number of iterations MaxIter to 500 or both.

About the cut point parameter cp, a number between 0 and 1 $(0 \le cp \le 1)$ will assure an initial convergence in distribution to a solution neighborhood for the first cp*MaxIter iterations and an almost sure convergence for the rest of the iterations. If you do not know how SAEM algorithm works, this parameter SHOULD NOT be changed.

This program uses progress bars that will close when the algorithm ends. They must not be closed before if not the algorithm will stop.

References

Delyon, B., Lavielle, M. & Moulines, E. (1999). Convergence of a stochastic approximation version of the EM algorithm. Annals of Statistics, pages 94-128.

Yu, K., & Zhang, J. (2005). A three-parameter asymmetric Laplace distribution and its extension. Communications in Statistics-Theory and Methods, 34(9-10), 1867-1879.

See Also

dALD, pALD, qALD, rALD

Examples

Run this code
#Using the Orthodontic distance growth data

library(nlme)
data(Orthodont)
attach(Orthodont)

y  = distance #response
x  = cbind(1,c(rep(0,64),rep(1,44)),age) #design matrix for fixed effects
z  = cbind(1,age) #design matrix for random effects
nj = rep(4,27)  #balanced

## Not run: 
# QRLMM(y,x,z,nj,MaxIter=100) #a quick median regression
# 
# 
# #Fit a very quick regression for the three quartiles (Just for having an idea!)
# QRLMM(y,x,z,nj,p = c(0.25,0.50,0.75),MaxIter=50,M=10)
# 
# #A full profile quantile regression (This might take some time)
# QRLMM(y,x,z,nj,p = seq(0.05,0.95,0.05),MaxIter=300,M=10)
# 
# #A simple output example
# -------------------------------------------------
# Quantile Regression for Linear Mixed Model
# -------------------------------------------------
# Quantile = 0.75
# Subjects = 27 ; Observations = 108 ; Balanced = 4
# -----------
# Estimates
# -----------
# - Fixed effects
# Estimate Std. Error z value Pr(>|z|)
# beta 1 17.08405 0.53524 31.91831 0
# 19
# beta 2 2.15393 0.36929 5.83265 0
# beta 3 0.61882 0.05807 10.65643 0
# sigma = 0.38439
# Random effects Varcov matrix
# z1 z2
# z1 0.16106 -0.00887
# z2 -0.00887 0.02839
# ------------------------
# Model selection criteria
# ------------------------
# Loglik AIC BIC HQ
# Value -216.454 446.907 465.682 454.52
# -------
# Details
# -------
# Convergence reached? = FALSE
# Iterations = 300 / 300
# Criteria = 0.00381
# MC sample = 10
# Cut point = 0.25
# Processing time = 7.590584 mins
# ## End(Not run)

Run the code above in your browser using DataLab