Learn R Programming

lqmm (version 1.02)

lqm: Fitting Linear Quantile Models

Description

lqm is used to fit linear quantile models based on the asymmetric Laplace distribution.

Usage

lqm(formula, data, subset, na.action, weights = NULL, iota = 0.5,
	contrasts = NULL, control = list(), fit = TRUE)

Arguments

formula
an object of class formula for fixed effects: a symbolic description of the model to be fitted.
data
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from envir
subset
an optional vector specifying a subset of observations to be used in the fitting process.
na.action
a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options.
weights
An optional vector of weights to be used in the fitting process.
iota
the quantile(s) to be estimated. This must be a number between 0 and 1, otherwise the execution is stopped. If more than one quantile is specified, rounding off to the 4th decimal must give non--duplicated values of iota, otherwise the execut
contrasts
an optional list. See the contrasts.arg of model.matrix.default.
control
list of control parameters of the fitting process. See lqmControl.
fit
logical flag. If FALSE the function returns a list of arguments to be passed to lqm.fit.gs.

Value

  • lqm returns an object of class lqm. The function summary is used to obtain and print a summary of the results. The generic accessor functions coefficients, predict and residuals extract various useful features of the value returned by lqm. An object of class lqm is a list containing the following components:
  • thetaa vector of coefficients. theta is a named matrix of coefficients when iota is a vector of values.
  • scalethe scale parameter.
  • logLikthe log--likelihood.
  • optdetails on optimization (see lqm.fit.gs).
  • callthe matched call.
  • term.labelsnames for theta.
  • termsthe terms object used.
  • nobsthe number of observations.
  • edf,dim_thetathe length of theta.
  • rdfthe number of residual degrees of freedom.
  • iotathe estimated quantile(s).
  • xthe model matrix.
  • ythe model response.
  • weightsthe weights used in the fitting process (a vector of 1's if weights = NULL).
  • InitialParstarting values for theta.
  • controllist of control parameters used for optimization (see lqmControl).

Details

The function computes an estimate on the iota-th quantile function of the response, conditional on the covariates, as specified by the formula argument. The quantile predictor is assumed to be linear. The function maximizes the (log)likelihood of a Laplace regression which is equivalent to the minimization of the weighted sum of absolute residuals (Koenker and Bassett, 1978). The optimization algorithm is based on the gradient of the Laplace log--likelihood (Bottai, Orsini and Geraci, 2011).

References

Bottai M, Orsini N and Geraci M (2011). A Gradient Search Maximization Algorithm for Laplace Likelihood. Unpublished manuscript. Koenker R and Bassett G (1978). Regression Quantiles. Econometrica 46(1), 33--50.

See Also

summary.lqm

Examples

Run this code
set.seed(12356)
n <- 200
p <- 1:3/4
test <- data.frame(x = runif(n,0,1))
test$y <- 30 + test$x + rnorm(n)
fit.lqm <- lqm(y ~ x, data = test, iota = p,
	control = list(verbose = FALSE, loop_tol = 0.001), fit = TRUE)
fit.lqm

Run the code above in your browser using DataLab