.fit.robust {tidyfit} | R Documentation |
Robust regression for tidyfit
Description
Fits a robust linear regression on a 'tidyFit' R6
class. The function can be used with regress
.
Usage
## S3 method for class 'robust'
.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
)
-
method
(estimation algorithm, e.g. 'M', 'MM')
The function provides a wrapper for MASS::rlm
. See ?rlm
for more details.
Implementation“
An argument vcov.
can be passed in control or to ...
in m
to estimate the model with robust standard errors. vcov.
can be one of "BS", "HAC", "HC" and "OPG" and is passed to the sandwich
package.
Value
A fitted 'tidyFit' class model.
Author(s)
Johann Pfitzinger
References
W. N. Venables and B. D. Ripley (2002).
Modern Applied Statistics with S. 4th ed., Springer, New York.
URL https://www.stats.ox.ac.uk/pub/MASS4/.
See Also
Examples
# Load data
data <- tidyfit::Factor_Industry_Returns
fit <- regress(data, Return ~ ., m("robust"), .mask = c("Date", "Industry"))
coef(fit)
# With robust standard errors
fit <- m("robust", Return ~ `Mkt-RF` + HML + SMB, data, vcov. = "HAC")
tidyr::unnest(coef(fit), model_info)