| .fit.spikeslab {tidyfit} | R Documentation |
Bayesian Spike and Slab regression or classification for tidyfit
Description
Fits a Bayesian Spike and Slab regression or classification on a 'tidyFit' R6 class. The function can be used with regress and classify.
Usage
## S3 method for class 'spikeslab'
.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). |
Details
Hyperparameters:
None. Cross validation not applicable.
Important method arguments (passed to m)
In the case of regression, arguments are passed to BoomSpikeSlab::lm.spike and BoomSpikeSlab::SpikeSlabPrior. Check those functions for details.
BoomSpikeSlab::SpikeSlabPrior
expected.r2
prior.df
expected.model.size
BoomSpikeSlab::lm.spike
niter
In the case of classification, arguments are passed to BoomSpikeSlab::logit.spike and BoomSpikeSlab::SpikeSlabGlmPrior. Check those functions for details.
BoomSpikeSlab::logit.spike
niter
I advise against the use of BoomSpikeSlab::SpikeSlabGlmPrior at the moment, since it appears to be buggy.
The function provides wrappers for BoomSpikeSlab::lm.spike and BoomSpikeSlab::logit.spike. See ?lm.spike and ?logit.spike for more details.
Implementation
Prior arguments are passed to BoomSpikeSlab::SpikeSlabPrior and BoomSpikeSlab::SpikeSlabGlmPrior (the function automatically identifies which arguments are for the prior, and which for BoomSpikeSlab::lm.spike or BoomSpikeSlab::logit.spike).
BoomSpikeSlab::logit.spike is automatically selected when using classify.
Value
A fitted tidyFit class model.
Author(s)
Johann Pfitzinger
References
Scott SL (2022). BoomSpikeSlab: MCMC for Spike and Slab Regression. R package version 1.2.5, https://CRAN.R-project.org/package=BoomSpikeSlab.
See Also
.fit.lasso, .fit.blasso and m methods
Examples
# Load data
data <- tidyfit::Factor_Industry_Returns
# Stand-alone function
fit <- m("spikeslab", Return ~ ., data, niter = 100)
fit
# Within 'regress' function
fit <- regress(data, Return ~ ., m("spikeslab", niter = 100),
.mask = c("Date", "Industry"))
coef(fit)