glmnetcr {glmnetcr} | R Documentation |
Fit a Penalized Constrained Continuation Ratio Model Using Lasso or Elasticnet Regularization Via 'glmnet'
Description
Fit a constrained continuation ratio model via penalized maximum likelihood. The regularization path is computed for the lasso or elasticnet penalty at a grid of values for the regularization parameter lambda. Can deal with all shapes of data, including very large sparse data matrices.
Usage
glmnetcr(x, y, method = "backward", weights = NULL, offset = NULL, alpha = 1,
nlambda = 100, lambda.min.ratio = NULL, lambda = NULL, standardize = TRUE,
thresh = 1e-04, exclude = NULL, penalty.factor = NULL, maxit = 100,
dfmax = nvars + 1, pmax = min(dfmax * 2 + 20, nvars),
type.logistic = c("Newton","modified.Newton"),
trace.it = 0 )
Arguments
x |
input data, of dimension nobs x nvars; each row is an observation vector. Can be in sparse column format (class |
y |
ordinal response variable |
method |
select between fitting a backward (default) versus a forward continuation ratio model |
weights |
observation weights. Can be total counts if responses are proportion matrices. Default is 1 for each observation |
offset |
A vector of length |
alpha |
The elasticnet mixing parameter, with
|
nlambda |
The number of |
lambda.min.ratio |
Smallest value for |
lambda |
A user supplied |
standardize |
Logical flag for variable standardization, prior to
fitting the model sequence. The coefficients are always returned on
the original scale. Default is |
thresh |
Convergence threshold for coordinate descent. Each inner
coordinate-descent loop continues until the maximum change in the
objective after any coefficient update is less than |
exclude |
Indices of variables to be excluded from the model. Default is none. Equivalent to an infinite penalty factor (next item). |
penalty.factor |
Separate penalty factors can be applied to each
coefficient. This is a number that multiplies |
maxit |
Maximum number of outer-loop iterations for
|
dfmax |
Limit the maximum number of variables in the model. Useful for very large |
pmax |
Limit the maximum number of variables ever to be nonzero. |
type.logistic |
If |
trace.it |
If |
Details
The sequence of models implied by lambda
is fit by coordinate
descent. This is a lasso or elasticnet regularization path
for fitting the generalized linear regression
paths, by maximizing the appropriate penalized log-likelihood. Sometimes the sequence is truncated before nlambda
values of lambda
have been used, because of instabilities in
the inverse link functions near a saturated fit. This function invokes glmnet(...,family="binomial")
which fits a traditional logistic regression model for the
log-odds. The
penalties take care of redundancies.
Value
call |
the call that produced this object |
a0 |
Intercept sequence of length |
beta |
a |
lambda |
The actual sequence of |
dev |
The fraction of (null) deviance explained (for |
nulldev |
Null deviance (per observation). This is defined to be -2*(loglike_sat -loglike(Null)); The NULL model refers to the intercept model. |
df |
The number of nonzero coefficients for each value of
|
dfmat |
Appliable for |
dim |
dimension of coefficient matrix (ices) |
nobs |
number of observations |
npasses |
total passes over the data summed over all lambda values |
offset |
a logical variable indicating whether an offset was included in the model |
jerr |
error flag, for warnings and errors (largely for internal debugging). |
x |
returns the original data matrix. Useful for |
y |
returns the original ordinal response. Useful for |
method |
returns the continuation ratio method (forward or backward). Useful for |
Note
This function depends heavily upon the glmnet
function in the glmnet package written by Jerome Friedman, Trevor Hastie and Rob Tibshirani
Author(s)
Kellie J. Archer, archer.43@osu.edu
See Also
See Also as glmnet
, select.glmnetcr
, fitted.glmnetcr
Examples
data(diabetes)
x <- diabetes[, 2:dim(diabetes)[2]]
y <- diabetes$y
glmnet.fit <- glmnetcr(x, y)
fitted(glmnet.fit, s = select.glmnetcr(glmnet.fit))