【发布时间】:2020-02-17 21:43:37
【问题描述】:
我是 R 新手,但有一些练习标记图,所以我认为这对于使用 boot() 的引导程序的结果是相同的。
#question 7
library(boot)
# function to obtain mean of x
fc <- function(x, indices){
dt <- x[indices]
c(mean(dt))
}
set.seed(123)
mybootstrap <- boot(x, fc, R=1000)
head(mybootstrap)
plot(mybootstrap, index=1,main="Boostrap mean of x", xlab="mean", ylab="density")
但实际上它给了我通用的“t 直方图”和“t*”的 xlab,而不是我在括号中指定这些内容的内容。为什么会这样?
【问题讨论】:
-
t* 是您尝试为每个引导程序估计的统计数据。 mybootstrap$t0 是您原始数据集的平均值,mybootstrap$t 是 1000 个引导程序的平均估计值,您刚刚看到的直方图是 hist(mybootstrap$t)
标签: r plot statistics-bootstrap