naginterfaces.library.correg.lars_param¶
- naginterfaces.library.correg.lars_param(b, fitsum, ktype, nk)[source]¶
lars_param
calculates additional parameter estimates following Least Angle Regression (LARS), forward stagewise linear regression or Least Absolute Shrinkage and Selection Operator (LASSO) as performed bylars()
andlars_xtx()
.For full information please refer to the NAG Library document for g02mc
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02mcf.html
- Parameters
- bfloat, array-like, shape
the parameter estimates, as returned by
lars()
andlars_xtx()
, with , the parameter estimate for the th variable, for , at the th step of the model fitting process.- fitsumfloat, array-like, shape
Summaries of the model fitting process, as returned by
lars()
andlars_xtx()
.- ktypeint
Indicates what target values are held in .
holds (fractional) LARS step numbers.
holds values for norm of the (scaled) parameters.
holds ratios with respect to the largest (scaled) norm.
holds values for the norm of the (unscaled) parameters.
holds ratios with respect to the largest (unscaled) norm.
If
lars()
was called with or orlars_xtx()
was called with then the model fitting routine did not rescale the independent variables, , prior to fitting the model and, therefore, there is no difference between or and or .- nkfloat, array-like, shape
Target values used for predicting the new set of parameter estimates.
- Returns
- nbfloat, ndarray, shape
the predicted parameter estimates, with , the parameter estimate for variable , at the point in the fitting process associated with , .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
has been corrupted since the last call to
lars()
orlars_xtx()
.- (errno )
has been corrupted since the last call to
lars()
orlars_xtx()
.- (errno )
On entry, .
Constraint: , , , or .
- (errno )
On entry, , and
Constraint: , for all .
- (errno )
On entry, , , and .
Constraint: , for all .
- (errno )
On entry, or , .
Constraint: , for all .
- (errno )
On entry, , and
Constraint: , for all .
- (errno )
On entry, .
Constraint: .
- Notes
lars()
andlars_xtx()
fit either a LARS, forward stagewise linear regression, LASSO or positive LASSO model to a vector of observed values, and an design matrix , where the th column of is given by the th independent variable . The models are fit using the LARS algorithm of Efron et al. (2004).[figure omitted]
The full solution path for all four of these models follow a similar pattern where the parameter estimate for a given variable is piecewise linear. One such path, for a LARS model with six variables can be seen in Figure [label omitted]. Both
lars()
andlars_xtx()
return the vector of parameter estimates, , at points along this path (so ). Each point corresponds to a step of the LARS algorithm. The number of steps taken depends on the model being fitted. In the case of a LARS model, and each step corresponds to a new variable being included in the model. In the case of the LASSO models, each step corresponds to either a new variable being included in the model or an existing variable being removed from the model; the value of is, therefore, no longer bound by the number of parameters. For forward stagewise linear regression, each step no longer corresponds to the addition or removal of a variable;, therefore, the number of possible steps is often markedly greater than for a corresponding LASSO model.lars_param
uses the piecewise linear nature of the solution path to predict the parameter estimates, , at a different point on this path. The location of the solution can either be defined in terms of a (fractional) step number or a function of the norm of the parameter estimates.
- References
Efron, B, Hastie, T, Johnstone, I and Tibshirani, R, 2004, Least Angle Regression, The Annals of Statistics (Volume 32) (2), 407–499
Hastie, T, Tibshirani, R and Friedman, J, 2001, The Elements of Statistical Learning: Data Mining, Inference and Prediction, Springer (New York)
Tibshirani, R, 1996, Regression Shrinkage and Selection via the Lasso, Journal of the Royal Statistics Society, Series B (Methodological) (Volume 58) (1), 267–288
Weisberg, S, 1985, Applied Linear Regression, Wiley