| .fit.lm | R Documentation |
tidyfitFits a linear regression on a 'tidyFit' R6 class. The function can be used with regress.
## S3 method for class 'lm'
.fit(self, data = NULL)
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). |
Hyperparameters:
None. Cross validation not applicable.
Important method arguments (passed to m)
The function provides a wrapper for stats::lm. See ?lm 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.
A fitted 'tidyFit' class model.
Johann Pfitzinger
.fit.robust, .fit.glm and m methods
# Load data
data <- tidyfit::Factor_Industry_Returns
# Stand-alone function
fit <- m("lm", Return ~ `Mkt-RF` + HML + SMB, data)
fit
# Within 'regress' function
fit <- regress(data, Return ~ ., m("lm"), .mask = c("Date", "Industry"))
coef(fit)
# With robust standard errors
fit <- m("lm", Return ~ `Mkt-RF` + HML + SMB, data, vcov. = "HAC")
fit
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.