Get startedGet started for free

The CER model

Before diving into the actual arithmetics, you first need to calculate the parameters of the constant expected return model (CER). Make use of the data in returns_df to estimate the model parameters for all four stocks.

This exercise is part of the course

Intro to Computational Finance with R

View Course

Exercise instructions

  • Assign to sigma2_month the estimates of \(\sigma_i^2\) for all four assets.
  • Calculate sigma_month, the estimates of \(\sigma_i\) for all four assets.
  • Estimate the correlations \(\rho_{ij}\) between all stocks, and assign the result to cor_mat_month.
  • Create the pairwise scatterplots between all four stocks. Use coredata() to extract the core data from returns_df and pairs() to create a matrix of scatter plots. Take the color blue and use 16 for points pch.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# All data is preloaded in your workspace.  Type ls() in the console to see what has been loaded.

# Parameters CER model
mu_hat_month <- apply(returns_df, 2, mean)
mu_hat_month
sigma2_month <-

sigma2_month
sigma_month <-

sigma_month
cov_mat_month <- var(returns_df)
cov_mat_month
cor_mat_month <-

cor_mat_month

# Pairwise scatterplots
Edit and Run Code