繁体   English   中英

使用`proportionBF`进行单样本比例测试(超过两个级别)

[英]using `proportionBF` to carry out one-sample proportion test (more than two levels)

我想计算一个样本比例测试的贝叶斯因子,其中零假设是 -

标称变量水平的比例与理论比例没有差异

我知道如何使用proportionBFBayesFactor包来做到这一点的时候有两个比例与零假设是,这两个级别是同样可能( p = 0.5 )。 这相当于stats::binom.test

# frequentist test (p-value > 0.05)
broom::tidy(stats::binom.test(x = 21, n = 44, p = 0.5))
#> # A tibble: 1 x 8
#>   estimate statistic p.value parameter conf.low conf.high method
#>      <dbl>     <dbl>   <dbl>     <dbl>    <dbl>     <dbl> <chr> 
#> 1    0.477        21   0.880        44    0.325     0.633 Exact~
#> # ... with 1 more variable: alternative <chr>

# quantifying evidence in favor of null hypothesis
library(BayesFactor)
1/ proportionBF(y = 21, N = 44, p = 0.5, rscale = 0.707)

#> Bayes factor analysis
#> --------------
#> [1] Null, p=0.5 : 3.724132 ±0.02%
#> 
#> Against denominator:
#>   Alternative, p0 = 0.5, r = 0.707, p =/= p0 
#> ---
#> Bayes factor type: BFproportion, logistic

但是,当有两个以上的比例时,我不知道如何进行这种分析,相当于stats::chisq.test (适合度测试)。

# frequentist test (p-value > 0.05)
table(mtcars$cyl)
#> 
#>  4  6  8 
#> 11  7 14
broom::tidy(stats::chisq.test(x = table(mtcars$cyl)))
#> # A tibble: 1 x 4
#>   statistic p.value parameter method                                  
#>       <dbl>   <dbl>     <dbl> <chr>                                   
#> 1      2.31   0.315         2 Chi-squared test for given probabilities

如何使用BayesFactor包计算此测试的贝叶斯因子?

(PS如果不可能,我也有兴趣知道任何其他可以做同样的包。)

BayesFactor作者在BayesFactor回答了这个问题: httpsBayesFactor

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM