Get startedGet started for free

The CER model

A quick recap on the constant expected return model (CER) as seen in the previous chapter:

$$R_{it} = \mu_i + \epsilon_{it} \text{, with } t = 1,\ldots,T$$ $$\epsilon_{it} \sim \text{ iid } N(0,\sigma_i ^ 2)$$ $$cov(\epsilon_{it},\epsilon_{jt}) = \sigma_{ij}$$

where \(R_{it}\) denotes the continuously compounded return on asset \(i\), now with \(i = \) Microsoft and Boeing.

As discussed in the previous chapter, the parameters \(\mu_i\), \(\sigma_i\) and \(\rho_{ij}\) are unknown to us. However, you can estimate the model parameters for both the Boeing and the Microsoft stock based on the data in returns_df.

This exercise is part of the course

Intro to Computational Finance with R

View Course

Exercise instructions

  • Assign to sigma2_annual the estimates of \(\sigma_i ^ 2\) for both assets (i.e. \(i = \) Boeing and Microsoft respectively). Calculate the corresponding \(\hat{\sigma}_i\) as well and assign it to sigma_annual.
  • The annual CER model parameters for Boeing are provided. Calculate those for Microsoft as well.
  • Estimate the correlations \(\rho_{ij}\) between both stocks and assign the result to rho_boeing_msft.

Hands-on interactive exercise

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

# The returns_df data is preloaded in your workspace

# Estimate the parameters: multivariate
mu_hat_annual <- apply(returns_df, 2, mean) * 12
sigma2_annual <-
sigma_annual <-
cov_mat_annual <- cov(returns_df) * 12
cov_hat_annual <- cov(returns_df)[1,2] * 12
rho_hat_annual <- cor(returns_df)[1,2]

# The annual estimates of the CER model parameters for Boeing and Microsoft
mu_boeing <- mu_hat_annual["rboeing"]
mu_msft <-
sigma2_boeing <-  sigma2_annual["rboeing"]
sigma2_msft <-
sigma_boeing <- sigma_annual["rboeing"]
sigma_msft <-
sigma_boeing_msft <- cov_hat_annual
rho_boeing_msft <-
Edit and Run Code