alasso {ARGOS}R Documentation

Adaptive Lasso

Description

This function performs adaptive lasso regression using the cv.glmnet function, then refits the model using ordinary least squares.

Usage

alasso(data, index, weights_method = c("ols", "ridge"), ols_ps = TRUE)

Arguments

data

A data frame or matrix containing the predictors and response. The response must be in the first column.

index

A numeric vector of indices indicating the rows of 'data' to use for the adaptive lasso regression.

weights_method

A character string specifying the method to calculate the weights. Can be either "ols" or "ridge". Default is "ols".

ols_ps

A logical scalar. If TRUE (default), the function returns the coefficients from the OLS fit. If FALSE, it returns the coefficients from the lasso fit.

Value

A numeric vector of coefficients. If 'ols_ps' is TRUE, these are the coefficients from the OLS fit. If 'ols_ps' is FALSE, these are the coefficients from the lasso fit. If an error occurs during the lasso or OLS fit, the function returns a vector of NAs.


[Package ARGOS version 0.1.1 Index]