Description Usage Arguments Details Value Note Author(s) See Also Examples
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.
1 2 3 4 5 6 | 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 )
|
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 0<α≤ 1. The penalty is defined as (1-α)/2||β||_2^2+α||β||_1.
|
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 |
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.
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 |
This function depends heavily upon the glmnet
function in the glmnet package written by Jerome Friedman, Trevor Hastie and Rob Tibshirani
Kellie J. Archer, archer.43@osu.edu
See Also as glmnet
, select.glmnetcr
, fitted.glmnetcr
1 2 3 4 5 6 7 8 9 |
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16
Warning message:
from glmnet Fortran code (error code -26); Convergence for 26th lambda value not reached after maxit=100 iterations; solutions for larger lambdas returned
$BIC
s23
33.76674
$AIC
s23
29.05452
$class
[1] "control" "control"
[3] "control" "control"
[5] "control" "control"
[7] "control" "control"
[9] "impaired fasting glucose" "control"
[11] "impaired fasting glucose" "impaired fasting glucose"
[13] "impaired fasting glucose" "impaired fasting glucose"
[15] "impaired fasting glucose" "type 2 diabetes"
[17] "type 2 diabetes" "type 2 diabetes"
[19] "type 2 diabetes" "type 2 diabetes"
[21] "type 2 diabetes" "type 2 diabetes"
[23] "type 2 diabetes" "type 2 diabetes"
$probs
control impaired fasting glucose type 2 diabetes
[1,] 0.637759660 0.2968232 0.06541710
[2,] 0.742789960 0.2154169 0.04179319
[3,] 0.684967374 0.2608598 0.05417284
[4,] 0.823974148 0.1494688 0.02655706
[5,] 0.678639532 0.2657438 0.05561666
[6,] 0.724791677 0.2297116 0.04549669
[7,] 0.711520081 0.2401679 0.04831200
[8,] 0.721282138 0.2324838 0.04623405
[9,] 0.184716536 0.5184572 0.29682629
[10,] 0.484526771 0.4040373 0.11143589
[11,] 0.133808976 0.5043899 0.36180108
[12,] 0.162057619 0.5146922 0.32325022
[13,] 0.106676146 0.4864906 0.40683329
[14,] 0.188845436 0.5187891 0.29236544
[15,] 0.208919007 0.5190637 0.27201725
[16,] 0.022632656 0.3065999 0.67076742
[17,] 0.024619264 0.3163697 0.65901106
[18,] 0.010433956 0.2251335 0.76443251
[19,] 0.008090478 0.2021177 0.78979178
[20,] 0.024136568 0.3140570 0.66180641
[21,] 0.007500334 0.1956351 0.79686456
[22,] 0.024556421 0.3160707 0.65937286
[23,] 0.012003293 0.2386296 0.74936710
[24,] 0.007139356 0.1915041 0.80135657
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.