Get linear model coefficients
lincoef(x, y, weights = NULL, method = c("glmnet", "cv.glmnet",
"lm.ridge", "allSubsets", "forwardStepwise", "backwardStepwise", "glm",
"sgd", "solve"), alpha = 0, lambda = 0.01, lambda.seq = NULL,
cv.glmnet.nfolds = 5, which.cv.glmnet.lambda = c("lambda.min",
"lambda.1se"), nbest = 1, nvmax = 8, sgd.model = "glm",
sgd.model.control = list(lambda1 = 0, lambda2 = 0),
sgd.control = list(method = "ai-sgd"), ...)
Features
Outcome
Float, vector: Case weights
String: Method to use:
"glm": uses stats::lm.wfit
;
"glmnet": uses glmnet::glmnet
;
"cv.glmnet": uses glmnet:cv.glmnet
;
"lm.ridge": uses MASS::lm.ridge
;
"allsubsets": uses leaps::regsubsets
with method = "exhaustive"
;
"forwardStepwise": uses leaps::regsubsets
with method = "forward};
"backwardStepwise": uses \code{leaps::regsubsets} with \code{method = "backward
;
"sgd": uses sgd::sgd
"solve": uses base::solve
Float: alpha
for method = glmnet
or cv.glmnet
. Default = 0
Float: The lambda value for glmnet
, cv.glmnet
, lm.ridge
Note: For glmnet
and cv.glmnet
, this is the lambda used for prediction. Training uses
lambda.seq
. Default = .01
Float, vector: lambda sequence for glmnet
and cv.glmnet
. Default = NULL
Integer: Number of folds for cv.glmnet
String: Whitch lambda to pick from cv.glmnet: "lambda.min": Lambda that gives minimum cross-validated error;
Integer: For method = "allSubsets"
, number of subsets of each size to record. Default = 1
Integer: For method = "allSubsets"
, maximum number of subsets to examine.
String: Model to use for method = "sgd"
. Default = "glm"
List: model.control
list to pass to sgd::sgd
List: sgd.control
list to pass to sgd::sgd
Additional parameters to pass to leaps::regsubsets
"lambda.1se": Largest lambda such that error is within 1 s.e. of the minimum.
Coefficients