## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo 
## 
## ── Attaching core tidyquant packages ──────────────────────── tidyquant 1.0.9 ──
## ✔ PerformanceAnalytics 2.0.4      ✔ TTR                  0.24.4
## ✔ quantmod             0.4.26     ✔ xts                  0.14.0
## ── Conflicts ────────────────────────────────────────── tidyquant_conflicts() ──
## ✖ zoo::as.Date()                 masks base::as.Date()
## ✖ zoo::as.Date.numeric()         masks base::as.Date.numeric()
## ✖ dplyr::filter()                masks stats::filter()
## ✖ xts::first()                   masks dplyr::first()
## ✖ dplyr::lag()                   masks stats::lag()
## ✖ xts::last()                    masks dplyr::last()
## ✖ PerformanceAnalytics::legend() masks graphics::legend()
## ✖ quantmod::summary()            masks base::summary()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

1 Get stock prices and convert to returns

## # A tibble: 27 × 3
## # Groups:   symbol [3]
##    symbol date             Ra
##    <chr>  <date>        <dbl>
##  1 AMZN   2024-01-31  0.0351 
##  2 AMZN   2024-02-29  0.139  
##  3 AMZN   2024-03-28  0.0205 
##  4 AMZN   2024-04-30 -0.0298 
##  5 AMZN   2024-05-31  0.00823
##  6 AMZN   2024-06-28  0.0953 
##  7 AMZN   2024-07-31 -0.0324 
##  8 AMZN   2024-08-30 -0.0454 
##  9 AMZN   2024-09-17  0.0469 
## 10 RGR    2024-01-31 -0.0309 
## # ℹ 17 more rows

2 Get baseline and convert to returns

## # A tibble: 9 × 2
##   date             Rb
##   <date>        <dbl>
## 1 2024-01-31  0.0270 
## 2 2024-02-29  0.0612 
## 3 2024-03-28  0.0179 
## 4 2024-04-30 -0.0441 
## 5 2024-05-31  0.0688 
## 6 2024-06-28  0.0596 
## 7 2024-07-31 -0.00751
## 8 2024-08-30  0.00649
## 9 2024-09-17 -0.00483

3 Join the two tables

## # A tibble: 27 × 4
## # Groups:   symbol [3]
##    symbol date             Ra       Rb
##    <chr>  <date>        <dbl>    <dbl>
##  1 AMZN   2024-01-31  0.0351   0.0270 
##  2 AMZN   2024-02-29  0.139    0.0612 
##  3 AMZN   2024-03-28  0.0205   0.0179 
##  4 AMZN   2024-04-30 -0.0298  -0.0441 
##  5 AMZN   2024-05-31  0.00823  0.0688 
##  6 AMZN   2024-06-28  0.0953   0.0596 
##  7 AMZN   2024-07-31 -0.0324  -0.00751
##  8 AMZN   2024-08-30 -0.0454   0.00649
##  9 AMZN   2024-09-17  0.0469  -0.00483
## 10 RGR    2024-01-31 -0.0309   0.0270 
## # ℹ 17 more rows

4 Calculate CAPM

## # A tibble: 3 × 13
## # Groups:   symbol [3]
##   symbol ActivePremium  Alpha AnnualizedAlpha   Beta `Beta-` `Beta+` Correlation
##   <chr>          <dbl>  <dbl>           <dbl>  <dbl>   <dbl>   <dbl>       <dbl>
## 1 AMZN           0.075 0.0043          0.0528  1.08    1.09    1.63        0.662
## 2 RGR           -0.356 0.0042          0.0518 -0.529   0.689  -0.428      -0.382
## 3 WMT            0.443 0.0329          0.475   0.667   0.778  -0.104       0.538
## # ℹ 5 more variables: `Correlationp-value` <dbl>, InformationRatio <dbl>,
## #   `R-squared` <dbl>, TrackingError <dbl>, TreynorRatio <dbl>

which stock/s has a positively stewed distribution of returns?

Walmart and Amazon were able to beat the market

I was also confused how you did the coding to find the skewness, would like to bring this up Monday, Thankyou.