Return the null deviance, starting mu and lambda max values for initialization. For internal use only.
get_start(x, y, weights, family, intercept, is.offset, offset, exclude, vp,
alpha, xm = NULL, xs = NULL)
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
and the user must also provide the xm
and xs
arguments. If it
is not a sparse matrix, it is assumed to be standardized.
Quantitative response variable.
Observation weights.
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.)
Does the model we are fitting have an intercept term or not?
Is the model being fit with an offset or not?
Offset for the model. If is.offset=FALSE
, this should be
a zero vector of the same length as y
.
Indices of variables to be excluded from the model.
Separate penalty factors can be applied to each coefficient.
The elasticnet mixing parameter, with \(0 \le \alpha \le 1\).
Vector of length nvars
: xm(j)
is the centering factor
for variable j. User should only provide them if x
is a sparse matrix.
Vector of length nvars
: xs(j)
is the scaling factor
for variable j. User should only provide them if x
is a sparse matrix.
This function is called by glmnet.path
for null deviance, starting mu
and lambda max values. It is also called by glmnet.fit
and
spglmnet.fit
when used without warmstart, but they only use the null
deviance and starting mu values.
When x
is not sparse, the xm
and xs
arguments are
ignored (x
is expected to already by centered and scaled). When
x
is sparse, these arguments represent the centering and scaling
factors for x
.
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.