Bootstrap Confidence Intervals in R
-
30-04-2021 - |
Domanda
I am a new R user, and am having trouble using the boot package. All I want to do is use bootstrapping to produce confidence intervals around a mean for a vector of numbers, such as:
x <- rnorm(100, 1, .5)
Any tips?
Soluzione
Doesn't the following suffice?
library(boot)
x <- rnorm(100, 1, .5)
b <- boot(x, function(u,i) mean(u[i]), R = 999)
boot.ci(b, type = c("norm", "basic", "perc"))
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow