.fit.cor {tidyfit} | R Documentation |
Pearson's correlation for tidyfit
Description
Calculates Pearson's correlation coefficient on a 'tidyFit' R6
class. The function can be used with regress
.
Usage
## S3 method for class 'cor'
.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
)
The function provides a wrapper for stats::cor.test
. See ?cor.test
for more details.
Implementation
Results can be viewed using coef
.
Value
A fitted 'tidyFit' class model.
Author(s)
Johann Pfitzinger
See Also
.fit.chisq
and m
methods
Examples
# Load data
data <- tidyfit::Factor_Industry_Returns
# Stand-alone function
fit <- m("cor", Return ~ `Mkt-RF` + HML + SMB, data)
fit
# Within 'regress' function
fit <- regress(data, Return ~ ., m("cor"), .mask = c("Date", "Industry"))
tidyr::unnest(coef(fit), model_info)
[Package tidyfit version 0.7.1 Index]