I am trying to calculate the confidence interval in R. Due to some special reasons, I have to do it with the functions in "bootstrap" package.(which means I can't use the functions in "boot" package.)
Here is my code.
And what I am doing is trying to calculate the Pearson correlation coefficient, and then apply the Bootstrap method (with B = 100) to obtain the estimate of the correlation coefficient. But I don't know how to construct the 95% confidence intervals.
library(bootstrap)
data('law')
set.seed(1)
theta <- function(ind) {
cor(law[ind, 1], law[ind, 2], method = "pearson")
}
law.boot <- bootstrap(1:15, 100, theta)
# sd(law$thetastar)
percent.95 <- function(x) {
quantile(x, .95)
}
law.percent.95 <- bootstrap(1:15, 100, theta, func=percent.95)
Sorry if I didn't make myself clear or tag the wrong tags. Sorry twice for not producing a dataset (now it's provided) and thank professor Roland for point it out. Thanks very much!
str(CD)
. – Roland