Returns the fitted coefficients from a lasso fit after tuning the regularization parameter by cross-validation. Intended for internal use with the linear_crt function.

get_beta_glmnet(X, Y, train_idx, family = "gaussian", s = "lambda.min",
  parallel = FALSE)

Arguments

X

and n by p matrix

Y

a response vector of length n

train_idx

a set of indices to train on

family

type of regression, either "gaussian" or "binomial"

s

coefficient vector to return. either "lambda.min" or "lambda.1se"

parallel

set to TRUE to run CV in parallel. Must initialize DoMC or DoParallel prior to execution.

Value

Fitted coefficients, a vector of length p + 1. First coordinate is the intercept.