Estimate linear models goodness of fit statistic
estimateStat.RdEstimate goodness of fit statistic of penalized linear regression models. Works with different goodness of fit statistic functions.
Arguments
- x
input matrix, of dimension nobs x nvars; each row is an observation vector. Can be in sparse matrix format (inherit from class
"sparseMatrix"as in packageMatrix)- y
response variable. Quantitative for
family="gaussian", orfamily="poisson"(non-negative counts). Forfamily="binomial"should be either a factor with two levels, or a two-column matrix of counts or proportions (the second column is treated as the target class; for a factor, the last level in alphabetical order is the target class). Forfamily="multinomial", can be anc>=2level factor, or a matrix withnccolumns of counts or proportions. For either"binomial"or"multinomial", ifyis presented as a vector, it will be coerced into a factor. Forfamily="cox", preferably aSurvobject from the survival package: see Details section for more information. Forfamily="mgaussian",yis a matrix of quantitative responses.- u
offset vector as in
glmnet."U"experiment in mae.- s
user supplied lambda.
- method
currently only cross-validation is implemented.
- nfold
number of fold to use in cross-validation.
- statistic
function computing goodness of fit statistic. Should accept
y,x,offsetarguments and return a numeric vector of the same length. Seersq,msefor examples.- alpha
The elasticnet mixing parameter, with \(0\le\alpha\le 1\). The penalty is defined as $$(1-\alpha)/2||\beta||_2^2+\alpha||\beta||_1.$$
alpha=1is the lasso penalty, andalpha=0the ridge penalty.