ppa: Posterior probability of association function

View source: R/NCmisc.R

ppaR Documentation

Posterior probability of association function

Description

Estimate the probability of your hypothesis being true, given the observed p-value and a prior probability of the hypothesis being true.

Usage

ppa(p = 0.05, prior = 0.5, BF = NULL, quiet = TRUE)

Arguments

p

p-value you want to test [p<0.367], or 'bayes factor'

prior

prior odds for the hypothesis (Ha) being tested

BF

logical, set to TRUE if you have entered a bayes factor as 'p' rather than a p-value

quiet

logical, whether to display verbose information for calculation

Value

prints calculations, then returns the posterior probability of association given the observed p-value under the specified prior

References

Equations 1, 2 from http://www.readcube.com/articles/10.1038/nrg2615 Equations 2, 3 from http://www.tandfonline.com/doi/pdf/10.1198/000313001300339950

Examples

ps <- rep(c(.05,.01),3)
prs <- rep(c(.05,.50,.90),each=2)
mapply(ps,prs,FUN=ppa)  # replicate Nuzzo 2014 table
# try with bayes factors
ppa(BF=3,prior=.9)
ppa(BF=10,prior=.5)

NCmisc documentation built on Oct. 17, 2022, 5:09 p.m.