We can implement a bootstrap analysis by performing this command many
times, recording all of the corresponding estimates for \(\alpha\), and computing
the resulting standard deviation. However, the boot()
function automates
this approach. Below we produce R = 1,000 bootstrap estimates for \(\alpha\).
> boot(Portfolio, alpha.fn, R = 1000)
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = Portfolio, statistic = alpha.fn, R = 1000)
Bootstrap Statistics :
original bias std. error
t1* 0.5758321 -0.001695873 0.09366347
The final output shows that using the original data, \(\hat\alpha = 0.576\), and that the bootstrap estimate for \(SE(\hat\alpha)\) is 0.0937.
Try to create 10 bootstrap estimates for your own and store them in bootstrap
:
Assume that:
ISLR2
and boot
libraries have been loadedPortfolio
dataset has been loaded and attached