0

i want to be able show density curve of the results of the bootstrap sample done in the package boot.

The package allows plot() to be used to graph histogram

But i cannot work out how to add density curve to plot () or which function will allow me to do density curve

library(boot)
library(ISLR2)

alpha.fn = function(data,index)
{
  X = data$X[index]
  Y = data$Y[index]
    (var(Y) - cov(X, Y)) / ( var(X) + var(Y) - 2 * cov(X, Y))
}

bootsample = boot(data, alpha.fn, R= 500)
plot(bootsample, index= 1)

histogram

user4891693
  • 35
  • 1
  • 2
  • 5

0 Answers0