Last data update: 2014.03.03

R: Least absolute deviations regression
ladR Documentation

Least absolute deviations regression

Description

This function is used to fit linear models considering Laplace errors.

Usage

lad(formula, data, method = c("BR", "EM"), subset, na.action,
  control, model = TRUE, x = FALSE, y = FALSE, contrasts = NULL)

Arguments

formula

an object of class "formula": a symbolic description of the model to be fitted.

data

an optional data frame containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lad is called.

method

character string specifying the algorithm to use. The default algorithm is the Barrodale and Roberts algorithm method = "BR". Other possible value is method = "EM" for an EM algorithm using IRLS.

subset

an optional expression indicating the subset of the rows of data that should be used in the fit.

na.action

a function that indicates what should happen when the data contain NAs.

control

a list of control values for the estimation algorithm to replace the default values returned by the function l1pack.control.

model, x, y

logicals. If TRUE the corresponding components of the fit (the model frame, the model matrix, the response) are returned.

contrasts

an optional list. See the contrasts.arg of model.matrix.default.

Value

an object of class lad representing the linear model fit. Generic function print, show the results of the fit.

Author(s)

The design was inspired by the R function lm.

References

Barrodale, I., and Roberts, F.D.K. (1974). Solution of an overdetermined system of equations in the L1 norm. Communications of the ACM 17, 319-320.

Phillips, R.F. (2002). Least absolute deviations estimation via the EM algorithm. Statistics and Computing 12, 281-285.

Examples

lad(stack.loss ~ ., data = stackloss, method = "EM")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(L1pack)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/L1pack/lad.Rd_%03d_medium.png", width=480, height=480)
> ### Name: lad
> ### Title: Least absolute deviations regression
> ### Aliases: lad
> ### Keywords: regression
> 
> ### ** Examples
> 
> lad(stack.loss ~ ., data = stackloss, method = "EM")
Call:
lad(formula = stack.loss ~ ., data = stackloss, method = "EM")
Converged in 105 iterations

Coefficients:
 (Intercept)    Air.Flow  Water.Temp  Acid.Conc. 
   -39.6899      0.8319      0.5739     -0.0609 

Degrees of freedom: 21 total; 17 residual
Scale estimate: 2.833893 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>