Exercise

Bootstrapping

In the previous exercise you rejected the null hypothesis that the returns were drawn from a normal distribution. In this exercise we will investigate the distribution of the estimator for the mean return, without making assumptions about the distribution of the returns and by using the technique called "bootstrapping"" that was introduced during the course.

In the code on the right, the function mean_boot is defined. It estimates the mean of the bootstrapped samples. It takes as first element the data (in this case the return series). As a second argument, it takes a vector that is used to scramble the data before estimating the mean. The output of the function is then the mean value that is computed by using resampled data.

In R, the boot package offers the boot() function for convenient bootstrapping. As a first argument, you should supply the data. As a second argument, the function used to estimate the parameter of interest (the mean_boot() function in this case) and as a third argument, the number of bootstrap samples that you would like to create. The output of the function should be an object of the class "boot".

This is the final exercise of this lab on DataCamp. If you would like to explore this topic more in depth, you can certainly have a look at "lab7.R" under the resources tab on Coursera.

Instructions

100 XP
  • Use the boot() function to generate 999 bootstrap samples based on the returns of VBLTX and assign the result to VBLTX_mean_boot.
  • Plot the bootstrapped distribution of the mean and a QQ-plot. This can be done by applying the plot() function on the VBLTX_mean_boot that you have created in the previous step.