Fits a sparse regression model using specialized algorithms for high-dimensional data.

fit_srm2(formula, data, verbose = TRUE, ...)

Arguments

formula

An object of class formula with a symbolic description of the model to be fitted.

data

A data.frame containing the variables in the model.

verbose

If TRUE, show warning messages.

...

Additional parameters passed to the underlying sparse regression function.

Value

A list containing two data frames:

  • metrics - Goodness of fit measures

  • coefficients - Fitted coefficients with sparse structure

Examples

data("example_matrix")
df <- as.data.frame(example_matrix)
fit_srm2(g1 ~ ., data = df)
#> $model
#> 
#> $metrics
#> # A tibble: 1 × 1
#>   r_squared
#>       <dbl>
#> 1     0.436
#> 
#> $coefficients
#> # A tibble: 17 × 2
#>    variable coefficient
#>    <chr>          <dbl>
#>  1 g10          0.00607
#>  2 g11          0.00629
#>  3 g12          0.0108 
#>  4 g13         -0.00152
#>  5 g14         -0.0131 
#>  6 g15          0.0167 
#>  7 g16         -0.0241 
#>  8 g17          0.0693 
#>  9 g18         -0.564  
#> 10 g2           0.218  
#> 11 g3           0.00755
#> 12 g4          -0.0177 
#> 13 g5           0.0236 
#> 14 g6          -0.0182 
#> 15 g7           0.0157 
#> 16 g8           0.00541
#> 17 g9          -0.0284 
#>