Testing normality for longer time horizons
As returns are added together over longer time periods, a central limit effect takes place and returns tend to become more normal.
In this exercise, you will use aggregation functions that you learned in the first chapter to aggregate the data in djx_d
, containing the daily log-returns for 29 of the Dow Jones stocks for the period 2000-2015. Then, you'll apply the Jarque-Bera test to the daily, weekly and monthly returns. djx_d
is loaded in your workspace.
This exercise is part of the course
Quantitative Risk Management in R
Exercise instructions
- Calculate weekly and monthly log-returns of
djx_d
and assign todjx_w
anddjx_m
, respectively. - Fill in
apply()
to calculate the p-value of the Jarque-Bera test for each of the Dow Jones daily return series indjx_d
. - Do the same for the weekly equity returns in
djx_w
. - Do the same for the monthly equity returns in
djx_m
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate weekly and monthly log-returns from djx_d
djx_w <- ___(___)
djx_m <- ___(___)
# Calculate the p-value for each series in djx_d
apply(___, 2, function(v){jarque.test(v)$p.value})
# Calculate the p-value for each series in djx_w
apply(___, 2, function(v){jarque.test(v)$p.value})
# Calculate the p-value for each series in djx_m
apply(___, 2, function(v){jarque.test(v)$p.value})