.fit.hfr {tidyfit} | R Documentation |
Hierarchical feature regression for tidyfit
Description
Fits a hierarchical feature regression on a 'tidyFit' R6
class. The function can be used with regress
.
Usage
## S3 method for class 'hfr'
.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:
kappa (proportional size of regression graph)
Important method arguments (passed to m
)
The hierarchical feature regression is estimated using the hfr::cv.hfr
function. See ?cv.hfr
for more details.
Implementation
Features are standardized by default with coefficients transformed to the original scale.
If no hyperparameter grid is provided (is.null(control$kappa)
), the default is seq(0, 1, by = 0.1)
.
Value
A fitted 'tidyFit' class model.
Author(s)
Johann Pfitzinger
References
Pfitzinger J (2022). hfr: Estimate Hierarchical Feature Regression Models. R package version 0.5.0, https://CRAN.R-project.org/package=hfr.
See Also
Examples
# Load data
data <- tidyfit::Factor_Industry_Returns
# Stand-alone function
fit <- m("hfr", Return ~ ., data, kappa = 0.5)
fit
# Within 'regress' function
fit <- regress(data, Return ~ ., m("hfr", kappa = c(0.1, 0.5)),
.mask = c("Date", "Industry"))
coef(fit)