run_lasso | R Documentation |
run_lasso
is a wrapper function that applies the lasso classifier to
data provided by the user, evaluates prediction performance, and chooses the
best-performing model.
run_lasso(
y,
L1.x,
L2.x,
L2.unit,
L2.reg,
n.iter,
loss.unit,
loss.fun,
lambda,
data,
verbose,
cores
)
y |
Outcome variable. A character vector containing the column names of
the outcome variable. A character scalar containing the column name of
the outcome variable in |
L1.x |
Individual-level covariates. A character vector containing the
column names of the individual-level variables in |
L2.x |
Context-level covariates. A character vector containing the
column names of the context-level variables in |
L2.unit |
Geographic unit. A character scalar containing the column
name of the geographic unit in |
L2.reg |
Geographic region. A character scalar containing the column
name of the geographic region in |
n.iter |
Lasso number of lambda values. An integer-valued scalar
specifying the number of lambda values to search over. Default is
|
loss.unit |
Loss function unit. A character-valued scalar indicating
whether performance loss should be evaluated at the level of individual
respondents ( |
loss.fun |
Loss function. A character-valued scalar indicating whether
prediction loss should be measured by the mean squared error ( |
lambda |
Lasso penalty parameter. A numeric |
data |
Data for cross-validation. A |
verbose |
Verbose output. A logical argument indicating whether or not
verbose output should be printed. Default is |
cores |
The number of cores to be used. An integer indicating the number of processor cores used for parallel computing. Default is 1. |
The tuned lambda value. A numeric scalar.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.