QREM: Fitting a quantile regression model via the EM algorithm.

QREMR Documentation

Fitting a quantile regression model via the EM algorithm.

Description

Fitting a quantile regression model via the EM algorithm.

Usage

QREM(
  func,
  linmod,
  dframe,
  qn,
  userwgts = NULL,
  ...,
  err = 10,
  maxit = 1000,
  tol = 0.001,
  maxInvLambda = 300
)

Arguments

func

The fitting function (lm, lmer, or gam).

linmod

A formula (the linear model for fitting in the M step).

dframe

A data frame containing the columns in the formula.

qn

The selected quantile. Must be in (0,1).

userwgts

The user-provided sampling weights (optional. Default=NULL.)

...

Any arguments to be passed to func (except for the formula and weights). Note that gam requires the family of the error distribution.

err

The initial value for the estimation error (default=10). Must be greater than tol (below).

maxit

The maximum number of EM iterations (default=1000).

tol

The error tolerance level (default=0.001).

maxInvLambda

The maximum value of the weight for WLS fitting (default=300).

Value

A list containing the following

  • coef The estimated regression coefficients (a list).

  • fitted.mod The output from lm(), lmer(), or gam() in the last EM iteration.

  • empq The percentage of points below the regression line (the empirical quantile).

  • ui The quantile regression residuals.

  • weights The weights used in the WLS solution.

  • iter The number of EM iterations.

  • err The final EM error (convergence criterion).

Examples

data(simdf)
qremFit <-  QREM(lm,linmod=y~x*x2 +x3, df=simdf, qn=0.2)
summary(aov(qremFit$fitted.mod))
summary(qremFit$fitted.mod)$coef

haimbar/QREM documentation built on Aug. 27, 2022, 7:10 p.m.