bayesboot: An Implementation of Rubin's (1981) Bayesian Bootstrap
- CRAN: http://cran.r-project.org/web/packages/bayesboot/index.html
- GitHub: https://github.com/rasmusab/bayesboot
> library(bayesboot)
バージョン: 0.2.0
関数名 | 概略 |
---|---|
as.bayesboot |
Coerce to a 'bayesboot' object |
bayesboot |
The Bayesian bootstrap |
plot.bayesboot |
Plot the result of 'bayesboot' |
plotPost |
Graphic display of a posterior probability distribution |
print.bayesboot |
Print the first number of draws from the Bayesian bootstrap |
rudirichlet |
Produce random draws from a uniform Dirichlet distribution |
summary.bayesboot |
Summarize the result of 'bayesboot' |
bayesboot
ベイジアンブーツストラップ
> heights <- c(183, 192, 182, 183, 177, 185, 188, 188, 182, 185)
> b1 <- bayesboot(heights, mean)
>
> summary(b1)
Bayesian bootstrap
Number of posterior draws: 4000
Summary of the posterior (with 95% Highest Density Intervals):
statistic mean sd hdi.low hdi.high
V1 184.4976 1.153094 182.3595 186.9408
Quantiles:
statistic q2.5% q25% median q75% q97.5%
V1 182.2388 183.7409 184.4529 185.2446 186.856
Call:
bayesboot(data = heights, statistic = mean)
> # plot(b1)
>
> b2 <- bayesboot(heights, weighted.mean, use.weights = TRUE)
> summary(b2)
Bayesian bootstrap
Number of posterior draws: 4000
Summary of the posterior (with 95% Highest Density Intervals):
statistic mean sd hdi.low hdi.high
V1 184.4773 1.188253 182.0777 186.8251
Quantiles:
statistic q2.5% q25% median q75% q97.5%
V1 182.0972 183.7012 184.4664 185.257 186.8499
Call:
bayesboot(data = heights, statistic = weighted.mean, use.weights = TRUE)
> # plot(b2)
plotPost
> rnorm(1e5, 3, 1) %>% plotPost()
rudirichlet
一様ディレクレ分布からのサンプリング
> set.seed(71)
> rudirichlet(2, 3)
[,1] [,2] [,3]
[1,] 0.43594077 0.4264839 0.1375754
[2,] 0.05651936 0.8233262 0.1201545