Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_start

Get null deviance, starting mu and lambda max


Description

Return the null deviance, starting mu and lambda max values for initialization. For internal use only.

Usage

get_start(
  x,
  y,
  weights,
  family,
  intercept,
  is.offset,
  offset,
  exclude,
  vp,
  alpha
)

Arguments

x

Input matrix, of dimension nobs x nvars; each row is an observation vector. If it is a sparse matrix, it is assumed to be unstandardized. It should have attributes xm and xs, where xm(j) and xs(j) are the centering and scaling factors for variable j respsectively. If it is not a sparse matrix, it is assumed to be standardized.

y

Quantitative response variable.

weights

Observation weights.

family

A description of the error distribution and link function to be used in the model. This is the result of a call to a family function. (See family for details on family functions.)

intercept

Does the model we are fitting have an intercept term or not?

is.offset

Is the model being fit with an offset or not?

offset

Offset for the model. If is.offset=FALSE, this should be a zero vector of the same length as y.

exclude

Indices of variables to be excluded from the model.

vp

Separate penalty factors can be applied to each coefficient.

alpha

The elasticnet mixing parameter, with 0 ≤ α ≤ 1.

Details

This function is called by glmnet.path for null deviance, starting mu and lambda max values. It is also called by glmnet.fit when used without warmstart, but they only use the null deviance and starting mu values.

When x is not sparse, it is expected to already by centered and scaled. When x is sparse, the function will get its attributes xm and xs for its centering and scaling factors.

Note that whether x is centered & scaled or not, the values of mu and nulldev don't change. However, the value of lambda_max does change, and we need xm and xs to get the correct value.


glmnet

Lasso and Elastic-Net Regularized Generalized Linear Models

v4.1-1
GPL-2
Authors
Jerome Friedman [aut], Trevor Hastie [aut, cre], Rob Tibshirani [aut], Balasubramanian Narasimhan [aut], Kenneth Tay [aut], Noah Simon [aut], Junyang Qian [ctb]
Initial release
2021-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.