Skip to content

Fits a Bayesian Lasso regression on a 'tidyFit' R6 class. The function can be used with regress.

Usage

# S3 method for class 'blasso'
.fit(self, data = NULL)

Arguments

self

a tidyFit R6 class.

data

a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

Value

A fitted tidyFit class model.

Details

Hyperparameters:

None. Cross validation not applicable.

Important method arguments (passed to m)

The function provides a wrapper for monomvn::blasso. See ?blasso for more details.

Implementation

Features are standardized by default with coefficients transformed to the original scale.

References

Gramacy RB, (qpgen2/quadprog) wFcfCMaubBAT (2023). monomvn: Estimation for MVN and Student-t Data with Monotone Missingness. R package version 1.9-17, https://CRAN.R-project.org/package=monomvn.

See also

.fit.lasso, .fit.bridge and m methods

Author

Johann Pfitzinger

Examples

# Load data
data <- tidyfit::Factor_Industry_Returns

# Stand-alone function
fit <- m("blasso", Return ~ ., data, T = 100)
fit
#> # A tibble: 1 × 5
#>   estimator_fct   `size (MB)` grid_id  model_object settings        
#>   <chr>                 <dbl> <chr>    <list>       <list>          
#> 1 monomvn::blasso        4.11 #0010000 <tidyFit>    <tibble [1 × 1]>

# Within 'regress' function
fit <- regress(data, Return ~ ., m("blasso", T = 100),
               .mask = c("Date", "Industry"))
coef(fit)
#> # A tibble: 7 × 4
#> # Groups:   model [1]
#>   model  term        estimate model_info      
#>   <chr>  <chr>          <dbl> <list>          
#> 1 blasso (Intercept) -0.0125  <tibble [1 × 2]>
#> 2 blasso Mkt-RF       0.968   <tibble [1 × 2]>
#> 3 blasso SMB          0.00583 <tibble [1 × 2]>
#> 4 blasso HML          0.0588  <tibble [1 × 2]>
#> 5 blasso RMW          0.156   <tibble [1 × 2]>
#> 6 blasso CMA          0.108   <tibble [1 × 2]>
#> 7 blasso RF           0.964   <tibble [1 × 2]>