I have calculated an estimate for the tenth percentile of the column medv in the Boston data set. I want to calculate the standard error of the 0.1 percentile using the bootstrap. I have written this function to calculate it but It is not giving me the right value.
Can you show me a way to calculate the standard error of a certain percentile using bootstrapping?
Note: I'm aware of the package 'boot' but I want to use a custom function.
library(MASS) data(Boston) μ.hat0.1 <- quantile(medv, c(0.1)) set.seed(20218) boot <- function(times, data=Boston$medv) { boots <- rep(NA, times) for (i in 1:times) { boots[i] <- quantileSE(sample(data, length(data), replace=TRUE),p=0.1) } boots } mean(boot(times=1000)) https://stackoverflow.com/questions/66775065/how-can-i-can-estimate-the-standard-error-of-the-0-1-percentile-using-the-bootst March 24, 2021 at 01:06PM
没有评论:
发表评论