-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: New function that returns covariance matrix #42
Comments
After some thinking, I have some questions:
|
First, I think this will be a very good addition to your package. From the financial side, the intended use will be with stock returns over time to understand how multiple stocks move together. This article explains more about how I will end up using it. http://www.investopedia.com/articles/financial-theory/11/calculating-covariance.asp I'll collect some feedback from others as well, but here are some initial thoughts:
Overall, I think the |
I like |
I'm on board with that. It seems that it will be easier to handle for |
Is this request still current? |
Closed in #116 thanks to @jameslairdsmith: library(corrr)
colpair_map(mtcars, cov)
#> # A tibble: 11 x 12
#> rowname mpg cyl disp hp drat wt qsec vs
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 mpg NA -9.17 -633. -321. 2.20 -5.12 4.51 2.02
#> 2 cyl -9.17 NA 200. 102. -0.668 1.37 -1.89 -0.730
#> 3 disp -633. 200. NA 6721. -47.1 108. -96.1 -44.4
#> 4 hp -321. 102. 6721. NA -16.5 44.2 -86.8 -25.0
#> 5 drat 2.20 -0.668 -47.1 -16.5 NA -0.373 0.0871 0.119
#> 6 wt -5.12 1.37 108. 44.2 -0.373 NA -0.305 -0.274
#> 7 qsec 4.51 -1.89 -96.1 -86.8 0.0871 -0.305 NA 0.671
#> 8 vs 2.02 -0.730 -44.4 -25.0 0.119 -0.274 0.671 NA
#> 9 am 1.80 -0.466 -36.6 -8.32 0.190 -0.338 -0.205 0.0423
#> 10 gear 2.14 -0.649 -50.8 -6.36 0.276 -0.421 -0.280 0.0766
#> 11 carb -5.36 1.52 79.1 83.0 -0.0784 0.676 -1.89 -0.464
#> # … with 3 more variables: am <dbl>, gear <dbl>, carb <dbl> Created on 2020-11-02 by the reprex package (v0.3.0.9001) |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
Great package. Something to consider is a function similar to
correlate()
that would return the covariance matrix. This will greatly assist with financial analysis.The text was updated successfully, but these errors were encountered: