View source: R/31_pre_processing_functions.R
fit_lasso | R Documentation |
Performs Lasso or group Lasso logistic regression to distinguish between two groups of samples.
fit_lasso(
control_train,
treat_train,
lambda_type = c("lambda.min", "lambda.1se"),
classifier_method = c("lasso", "group_lasso"),
group = NULL
)
control_train |
A matrix or data frame for the control group. Rows are samples, columns are features. |
treat_train |
A matrix or data frame for the treatment group. Rows are samples, columns are features. |
lambda_type |
Character. Type of lambda to use from cross-validation. Options are |
classifier_method |
Character. Choice of classifier. |
group |
Optional grouping vector for |
The function fits a logistic regression using either glmnet
for Lasso or grpreg
for group Lasso.
Coefficients are soft-thresholded by the maximum coefficient times n^(-1/3)
where n
is the effective sample size.
A numeric vector of estimated regression coefficients (excluding intercept), thresholded for small values.
## Not run:
X1 <- matrix(rnorm(100), nrow = 10)
X2 <- matrix(rnorm(100), nrow = 10)
fit_lasso(X1, X2, classifier_method = "lasso")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.