Description Usage Arguments Details Value Note Author(s) References See Also Examples
nlqmm
is used to fit nonlinear quantile mixed models based on the asymmetric Laplace distribution.
1 2 3 4 |
model |
a nonlinear model formula, with the response on the left of a ~ operator and an expression involving parameters and covariates on the right. |
fixed |
a two-sided linear formula of the form |
random |
a two-sided linear formula of the form |
group |
grouping factor. |
covariance |
variance–covariance matrix of the random effects. Default is |
tau |
the quantile(s) to be estimated. |
data |
an optional data frame containing the variables named in
|
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
weights |
an optional vector specifying likelihood weights (see details). |
na.action |
a function that indicates what should happen when the
data contain |
control |
list of control parameters of the fitting process. See |
nlmeFit |
a |
start |
an optional list of initial (crude) estimates for the fixed effects (see details and |
gradHess |
logical flag. If |
fit |
logical flag. If |
The function computes an estimate on the tau-th quantile function of the response, conditional on the covariates, as specified by the formula
argument, and on random effects, as specified by the random
argument. The quantile predictor is assumed to be nonlinear. The function maximizes the (log)likelihood of the Laplace regression proposed by Geraci (2019) using a Laplacian approximation of the likelihood. The optimization algorithm minimizes the negative smoothed Laplace log–likelihood using optim
. The available options are the Nelder-Mead and BFGS algorithms which are specified via the argument method
in nlqmmControl
.
Optional starting values for the fixed effects are provided via start
. Parameters are named internally as b1
, b2
, ... See examples further below. These values are then passed on to the initialization algorithm (see nlqmmControl
) which provides the initial values to the nlqmm
algorithm.
Different standard types of positive–definite matrices for the random effects can be specified: pdIdent
multiple of an identity; pdCompSymm
compound symmetry structure (constant diagonal and constant off–diagonal elements); pdDiag
diagonal; pdSymm
general positive–definite matrix, with no additional structure.
Weights are assumed to be the same for all observations within the same cluster. Weights must be strictly positive. These represent likelihood weights: the larger the weight for a cluster, the more importance is given to the cluster during estimation.
If gradHess = TRUE
, the gradient and Hessian of the log-likelihood are calculated at the optimum. The results are stored as attributes of logLik
and can be extracted via logLik.nlqmm
. If calculation fails, a warning will be printed out.
nlqmm
returns an object of class
nlqmm
.
Updates/FAQ/news are published here http://marcogeraci.wordpress.com/. New versions are usually published here https://r-forge.r-project.org/R/?group_id=1396 before going on CRAN.
Marco Geraci
Chen C. (2007). A finite smoothing algorithm for quantile regression. Journal of Computational and Graphical Statistics, 16(1), 136-164.
Geraci M. (2019). Modelling and estimation of nonlinear quantile regression with clustered data. Computational Statistics and Data Analysis, 136, 30-46.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | ## Not run:
# Pharmacokinetics of Indomethacin (package datasets)
Indometh$Subject <- as.factor(as.numeric(Indometh$Subject))
tau <- c(.1,.5,.9)
nt <- length(tau)
# Provide starting values for fixed effects
ss <- list(b1 = 3, b2 = 0.5, b3 = 0.5, b4 = -1)
# Fit bi-exponential mixed models for 3 quantiles
fit <- list()
ctrl <- nlqmmControl(method = "Nelder-Mead", initialize = "nlrq", verbose = FALSE)
for(i in 1:nt){
fit[[i]] <- nlqmm(conc ~ A1*exp(-exp(lrc1)*time)+A2*exp(-exp(lrc2)*time),
data = Indometh, fixed = A1 + lrc1 + A2 + lrc2 ~ 1,
random = A1 + lrc1 + A2 ~ 1, group = Subject, tau = tau[i],
covariance = "pdDiag", start = ss, control = ctrl, fit = TRUE)
}
## End(Not run)
## Not run:
# Growth of soybean plants (package nlme)
data(Soybean, package = "nlme")
tau <- c(0.05, .1, .5, .9, .95)
nt <- length(tau)
ss <- c(20, -8, -3, 1.6, 5.5, 0.1, 54.8, -2, -5, -1, 8, -1, -0.6) # Pinheiro and Bates (2000, p.294)
# Fit logistic mixed models for 5 quantiles
ctrl <- nlqmmControl(method = "BFGS", initialize = "nlrq", verbose = FALSE,
beta = 0.2, LL_tol = 1e-05)
names(ss) <- paste0("b", 1:13)
fit <- list()
for(i in 1:nt){
fit[[i]] <- nlqmm(weight ~ Asym/(1+exp((xmid-Time)/scal)), data = Soybean,
fixed = list(Asym ~ Year*Variety, xmid ~ Year + Variety, scal ~ Year),
random = Asym ~ 1, group = Plot, tau = tau[i], covariance = "pdSymm",
start = as.list(ss), control = ctrl, fit = TRUE)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.