Description Usage Arguments Details Value Author(s) See Also Examples

Bayes factors or posterior samples for binomial, geometric, or neg. binomial data.

1 2 | ```
proportionBF(y, N, p, rscale = "medium", nullInterval = NULL,
posterior = FALSE, callback = function(...) as.integer(0), ...)
``` |

`y` |
a vector of successes |

`N` |
a vector of total number of observations |

`p` |
the null value for the probability of a success to be tested against |

`rscale` |
prior scale. A number of preset values can be given as strings; see Details. |

`nullInterval` |
optional vector of length 2 containing lower and upper bounds of an interval hypothesis to test, in probability units |

`posterior` |
if |

`callback` |
callback function for third-party interfaces |

`...` |
further arguments to be passed to or from methods. |

Given count data modeled as a binomial, geometric, or negative binomial random variable,
the Bayes factor provided by `proportionBF`

tests the null hypothesis that
the probability of a success is *p_0* (argument `p`

). Specifically,
the Bayes factor compares two hypotheses: that the probability is *p_0*, or
probability is not *p_0*. Currently, the default alternative is that

*λ~logistic(λ_0,r)*

where
*lambda_0=logit(p_0)* and
*lambda=logit(p)*. *r* serves as a prior scale parameter.

For the `rscale`

argument, several named values are recognized:
"medium", "wide", and "ultrawide". These correspond
to *r* scale values of *1/2*, *sqrt(2)/2*, and 1,
respectively.

The Bayes factor is computed via Gaussian quadrature, and posterior samples are drawn via independence Metropolis-Hastings.

If `posterior`

is `FALSE`

, an object of class
`BFBayesFactor`

containing the computed model comparisons is
returned. If `nullInterval`

is defined, then two Bayes factors will
be computed: The Bayes factor for the interval against the null hypothesis
that the probability is *p0*, and the corresponding Bayes factor for
the compliment of the interval.

If `posterior`

is `TRUE`

, an object of class `BFmcmc`

,
containing MCMC samples from the posterior is returned.

Richard D. Morey ([email protected])

1 2 3 4 5 | ```
bf = proportionBF(y = 15, N = 25, p = .5)
bf
## Sample from the corresponding posterior distribution
samples =proportionBF(y = 15, N = 25, p = .5, posterior = TRUE, iterations = 10000)
plot(samples[,"p"])
``` |

```
Loading required package: coda
Loading required package: Matrix
************
Welcome to BayesFactor 0.9.12-2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
Type BFManual() to open the manual.
************
Bayes factor analysis
--------------
[1] Alt., p0=0.5, r=0.5 : 0.6598725 <U+00B1>0%
Against denominator:
Null, p = 0.5
---
Bayes factor type: BFproportion, logistic
Independent-candidate M-H acceptance rate: 90%
```

BayesFactor documentation built on May 29, 2017, 3:51 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.