【问题标题】:cannot change the main title and x, y labels for plot() of boot() result无法更改 boot() 结果的 plot() 的主标题和 x、y 标签
【发布时间】: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


【解决方案1】:

boot 中调整绘图设置并不容易。最好是拔出t 并使用plotfreq=F 来获得密度图:

 hist(mybootstrap$t, freq = FALSE, breaks = 50,
     main="Boostrap mean of x", xlab="mean", ylab="density")

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-10
    • 1970-01-01
    • 2017-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-28
    相关资源
    最近更新 更多