Fits a linear quantile regression on a 'tidyFit' R6
class. The function can be used with regress
.
# S3 method for class 'quantile'
.fit(self, data = NULL)
A fitted 'tidyFit' class model.
Hyperparameters:
None. Cross validation not applicable.
Important method arguments (passed to m
)
tau
(the quantile(s) to be estimated)
The function provides a wrapper for quantreg::rq
. See ?rq
for more details. The argument tau
is the chosen quantile (default tau = 0.5
).
Implementation
No implementation notes
Koenker R (2022). quantreg: Quantile Regression. R package version 5.94, https://CRAN.R-project.org/package=quantreg.
.fit.lm
, .fit.bayes
and m
methods
# Load data
data <- tidyfit::Factor_Industry_Returns
data <- dplyr::filter(data, Industry == "HiTec")
fit <- regress(data, Return ~ .,
m("quantile", tau = c(0.1, 0.5, 0.9)),
.mask = c("Date", "Industry"))
coef(fit)
#> # A tibble: 21 × 4
#> # Groups: model [1]
#> model term estimate model_info
#> <chr> <chr> <dbl> <list>
#> 1 quantile (Intercept) -2.39 <tibble [1 × 3]>
#> 2 quantile Mkt-RF 0.985 <tibble [1 × 3]>
#> 3 quantile SMB 0.201 <tibble [1 × 3]>
#> 4 quantile HML -0.340 <tibble [1 × 3]>
#> 5 quantile RMW -0.490 <tibble [1 × 3]>
#> 6 quantile CMA -0.593 <tibble [1 × 3]>
#> 7 quantile RF -0.228 <tibble [1 × 3]>
#> 8 quantile (Intercept) 0.649 <tibble [1 × 3]>
#> 9 quantile Mkt-RF 1.07 <tibble [1 × 3]>
#> 10 quantile SMB 0.0500 <tibble [1 × 3]>
#> # ℹ 11 more rows