.fit.tvp {tidyfit} | R Documentation |
Bayesian Time-Varying Regression for tidyfit
Description
Fits a Bayesian time-varying regression on a 'tidyFit' R6
class. The function can be used with regress
.
Usage
## S3 method for class 'tvp'
.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
)
-
mod_type
-
niter
(number of MCMC iterations)
The function provides a wrapper for shrinkTVP::shrinkTVP
. See ?shrinkTVP
for more details.
Implementation
An argument index_col
can be passed, which allows a custom index to be added to coef(m("tvp"))
(e.g. a date index, see Examples).
Value
A fitted 'tidyFit' class model.
Author(s)
Johann Pfitzinger
References
Peter Knaus, Angela Bitto-Nemling, Annalisa Cadonna and Sylvia Frühwirth-Schnatter (2021).
Shrinkage in the Time-Varying Parameter Model Framework Using the R Package shrinkTVP.
Journal of Statistical Software 100(13), 1–32.
doi:10.18637/jss.v100.i13.
See Also
.fit.bayes
, .fit.mslm
and m
methods
Examples
# Load data
data <- tidyfit::Factor_Industry_Returns
data <- dplyr::filter(data, Industry == "HiTec")
data <- dplyr::select(data, -Industry)
# Within 'regress' function (using low niter for illustration)
fit <- regress(data, Return ~ ., m("tvp", niter = 50, index_col = "Date"))
tidyr::unnest(coef(fit), model_info)