multibridge v1.1.0
Monthly downloads
Evaluating Multinomial Order Restrictions with Bridge Sampling
Evaluate hypotheses concerning the distribution of multinomial
proportions using bridge sampling. The bridge sampling routine is able to
compute Bayes factors for hypotheses that entail inequality constraints,
equality constraints, free parameters, and mixtures of all three. These
hypotheses are tested against the encompassing hypothesis, that all parameters
vary freely or against the null hypothesis that all category proportions are equal.
For more information see Sarafoglou et al. (2020) <doi:10.31234/osf.io/bux7p>.
Readme
multibridge: Evaluating Multinomial Order Restrictions with Bridge Sampling
Evaluates hypotheses concerning the distribution of multinomial proportions using bridge sampling. The bridge sampling routine is able to compute Bayes factors for hypotheses that entail inequality constraints, equality constraints, free parameters, and a mix of all three. These hypotheses are tested against the encompassing hypothesis, that all parameters vary freely.
Installation
System requirement is the library mpfr
with a version bigger than
3.0.0
. To install mpfr
, you need a C compiler, preferably GCC.
Detailed information on how to install mpfr
are available at
https://www.mpfr.org/mpfr-current/mpfr.html.
On Mac you can install mpfr
through the Terminal (assuming that brew
is installed on your machine).
brew install mpfr
On Debian or Ubuntu you can install mpfr
through the Terminal:
sudo apt-get install libmpfr-dev
You can install the released version of multibridge
from
CRAN with:
install.packages("multibridge")
And the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("ASarafoglou/multibridge")
Example
This is a basic example which shows you how to solve a common problem:
library("multibridge")
# data
x <- c(3, 4, 10, 11, 7, 30)
# priors
a <- c(1, 1, 1, 1, 1, 1)
# category labels
factor_levels <- c('theta1', 'theta2',
'theta3', 'theta4',
'theta5', 'theta6')
# constrained hypothesis
Hr <- c('theta1', '<', 'theta2', '&',
'theta3', '=', 'theta4', ',',
'theta5', '<', 'theta6')
output <- mult_bf_informed(x, Hr, a, factor_levels, seed=2020, niter=2e3)
m1 <- summary(output)
m1
#> Bayes factor analysis
#>
#> Hypothesis H_e:
#> All parameters are free to vary.
#>
#> Hypothesis H_r:
#> theta1 < theta2 & theta3 = theta4 , theta5 < theta6
#>
#> Bayes factor estimate LogBFer:
#>
#> -2.4239
#>
#> Based on 1 independent equality-constrained hypothesis
#> and 2 independent inequality-constrained hypotheses.
#>
#> Relative Mean-Square Error:
#>
#> 6.29e-05
#>
#> Posterior Median and Credible Intervals Of Marginal Beta Distributions:
#> alpha beta 2.5% 50% 97.5%
#> 1 theta1 1 + 3 5 + 62 0.0158 0.0522 0.120
#> 2 theta2 1 + 4 5 + 61 0.0236 0.0664 0.140
#> 3 theta3 1 + 10 5 + 55 0.0811 0.1520 0.247
#> 4 theta4 1 + 11 5 + 54 0.0918 0.1660 0.264
#> 5 theta5 1 + 7 5 + 58 0.0507 0.1090 0.195
#> 6 theta6 1 + 30 5 + 35 0.3240 0.4360 0.553
Package dependencies
Functions in multibridge
Name | Description | |
mult_bf_inequality | Computes Bayes Factors For Inequality Constrained Multinomial Parameters | |
journals | Prevalence of Statistical Reporting Errors | |
generate_restriction_list | Creates Restriction List Based On User Specified Informed Hypothesis | |
mult_bf_informed | Evaluates Informed Hypotheses on Multinomial Parameters | |
print.summary.bmult_bridge | print method for class summary.bmult_bridge | |
summary.bmult | summary method for class bmult | |
restriction_list | S3 method for class restriction_list.bmult | |
samples.bmult | Extracts prior and posterior samples (if applicable) from an object of class bmult | |
mult_tsampling | Samples From Truncated Dirichlet Density | |
tbinom_trans | Transforms Truncated Beta Samples To Real Line | |
peas | Mendelian Laws of Inheritance | |
bridge_output.bmult | Extracts bridge sampling output from object of class bmult | |
lifestresses | Memory of Life Stresses | |
mult_bf_equality | Computes Bayes Factors For Equality Constrained Multinomial Parameters | |
tdir_backtrans | Backtransforms Samples From Real Line To Dirichlet Parameters | |
tbinom_backtrans | Backtransforms Samples From Real Line To Beta Parameters | |
print.bmult | print method for class bmult | |
plot.summary.bmult | Plot estimates | |
summary.bmult_bridge | summary method for class bmult_bridge | |
print.bmult_bridge | Print method for class bmult_bridge | |
print.summary.bmult | print method for class summary.bmult | |
samples | S3 method for class 'samples.bmult' | |
restriction_list.bmult | Extracts restriction list from an object of class bmult | |
tdir_trans | Transforms Truncated Dirichlet Samples To Real Line | |
binom_bf_informed | Evaluates Informed Hypotheses on Multiple Binomial Parameters | |
.computeLengthOfRemainingStick | Computes Length Of Remaining Stick | |
binom_bf_equality | Computes Bayes Factors For Equality Constrained Binomial Parameters | |
.adjustUpperBoundForFreeParameters | Adjusts Upper Bound For Free Parameters | |
bridge_output | S3 method for class bridge_output.bmult | |
bayes_factor | S3 method for class 'bayes_factor.bmult' | |
binom_tsampling | Samples From Truncated Beta Densities | |
bayes_factor.bmult | Extracts information about computed Bayes factors from object of class bmult | |
binom_bf_inequality | Computes Bayes Factors For Inequality Constrained Independent Binomial Parameters | |
No Results! |
Vignettes of multibridge
Name | ||
MemoryOfLifestresses.Rmd | ||
MendelianLawsOfInheritance.Rmd | ||
PrevalenceOfStatisticalReportingErrors.Rmd | ||
No Results! |
Last month downloads
Details
Date | 2021-02-19 |
URL | https://github.com/asarafoglou/multibridge/ |
BugReports | https://github.com/asarafoglou/multibridge/issues |
License | GPL-2 |
Encoding | UTF-8 |
LazyData | true |
SystemRequirements | GNU make, mpfr (>= 3.0.0) |
RoxygenNote | 7.1.1 |
LinkingTo | Rcpp |
VignetteBuilder | knitr |
RdMacros | Rdpack |
NeedsCompilation | yes |
Packaged | 2021-02-22 14:51:05 UTC; alexandra.sarafoglou |
Repository | CRAN |
Date/Publication | 2021-02-23 11:10:02 UTC |
imports | Brobdingnag , coda , magrittr , mvtnorm , progress , purrr , Rcpp (>= 0.12.17) , Rdpack , stringr |
suggests | knitr , rmarkdown , testthat |
depends | R (>= 3.5.0) |
Contributors | Frederik Aust, Quentin F. Gronau, Joris Goosen, Julia M. Haaf, Maarten Marsman |
Include our badge in your README
[](http://www.rdocumentation.org/packages/multibridge)