Performs an L1 regression on a matrix of explanatory variables and a vector of responses.
l1fit(x, y, intercept = TRUE, tolerance = 1e-07, print.it = TRUE)
vector or matrix of explanatory variables. Each row corresponds to
an observation and each column to a variable. The number of rows of x
should equal the number of data values in y
, and there should be fewer
columns than rows. Missing values are not allowed.
numeric vector containing the response. Missing values are not allowed.
logical flag. If TRUE, an intercept term is included in the regression model.
numerical value used to test for singularity in the regression.
logical flag. If TRUE, then warnings about non-unique solutions and rank deficiency are given.
list defining the regression (compare with function lsfit
).
vector of coefficients.
residuals from the fit.
vector of one or two character strings stating whether a non-unique solution is possible, or if the x matrix was found to be rank deficient.
The Barrodale-Roberts algorithm, which is a specialized linear programming algorithm, is used.
Barrodale, I., and Roberts, F.D.K. (1973). An improved algorithm for discrete L1 linear approximations. SIAM Journal of Numerical Analysis 10, 839-848.
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.
Bloomfield, P., and Steiger, W.L. (1983). Least Absolute Deviations: Theory, Applications, and Algorithms. Birkhauser, Boston, Mass.
# NOT RUN {
l1fit(stack.x, stack.loss)
# }
Run the code above in your browser using DataLab