An application of Grouped LASSO penalisation. Whilst group LASSO may be used more generally to pre-specify arbitrary groupings of variables, it is used here to ensure selection of entire categorical variables with more than one dummy level.
Usage
analyse_grlasso(
x,
response = NULL,
vars = NULL,
family = "gaussian",
grpreg_list = list(NULL)
)
Arguments
- x
An output of the
bootstrap_data
function.- response
a character argument denoting the outcome.
- vars
a character vector denoting the covariates or features to be screened.
- family
the error distribution and link function passed to the
grpreg()
call inside theanalyse_grlasso
function. Currently onlygaussian
,binomial
andpoisson
are supported in thegrpreg
package with the present default set as"gaussian"
.- grpreg_list
a
list
passed to thegrpreg::grpreg
call. See?grpreg::grpreg
for more details.
Details
The present function is a simple wrapper for the grpreg::grpreg()
function. Grouped LASSO extends the standard LASSO penalty through the
introduction of a grouping index. This therefore applies variable
selection at the group level.
Examples
data(iswr_stroke)
iswr_stroke %>%
bootstrap_data(10, seed = 1234) %>%
analyse_grlasso(response = "dead12",
vars = c("Gender", "Age", "Diagnosis", "Coma",
"Diabetes", "MI", "Hypertension"),
family = "binomial",
grpreg_list = list(penalty = "grLasso"))
#> # A tibble: 10 × 3
#> boot_rep data vars
#> <int> <list> <list>
#> 1 1 <tibble [814 × 8]> <chr [6]>
#> 2 2 <tibble [814 × 8]> <chr [7]>
#> 3 3 <tibble [814 × 8]> <chr [7]>
#> 4 4 <tibble [814 × 8]> <chr [7]>
#> 5 5 <tibble [814 × 8]> <chr [7]>
#> 6 6 <tibble [814 × 8]> <chr [7]>
#> 7 7 <tibble [814 × 8]> <chr [7]>
#> 8 8 <tibble [814 × 8]> <chr [4]>
#> 9 9 <tibble [814 × 8]> <chr [6]>
#> 10 10 <tibble [814 × 8]> <chr [7]>