These functions compute the marginal posterior of the effect size \(\theta\). A power prior for \(\theta\) is constructed by updating an initial normal prior \(\theta \sim \mathrm{N}(\code{m}, \code{v})\) with likelihood of the original data raised to the power of \(\alpha\). The power parameter \(\alpha\) can either be fixed to some value between 0 and 1 or it can have a beta prior distribution \(\alpha \sim \mbox{Beta}(\code{x}, \code{y})\).
postPPtheta(
theta,
tr,
sr,
to,
so,
x = 1,
y = 1,
alpha = NA,
m = 0,
v = Inf,
hypergeo = FALSE,
...
)postPPthetaHPD(
level,
tr,
sr,
to,
so,
x = 1,
y = 1,
alpha = NA,
m = 0,
v = Inf,
thetaRange = tr + c(-1, 1) * stats::qnorm(p = (1 + level)/2) * sr * 3,
quantileRange = c((1 - level) * 0.2, (1 - level) * 0.8),
...
)
postPPtheta returns the marginal posterior density of the
effect size.
postPPthetaHPD returns the highest marginal posterior density
interval of the effect size (this may take a while).
Effect size. Can be a vector.
Effect estimate of the replication study.
Standard error of the replication effect estimate.
Effect estimate of the original study.
Standard error of the replication effect estimate.
Number of successes parameter for beta prior of power parameter
\(\alpha\). Defaults to 1. Is only taken into account
when alpha = NA.
Number of failures parameter for beta prior of power parameter
\(\alpha\). Defaults to 1. Is only taken into account
when alpha = NA.
Power parameter. Can be set to a number between 0 and 1.
Defaults to NA (a beta prior on the power parameter).
Mean parameter of initial normal prior for \(\theta\).
Defaults to 0.
Variance parameter of initial normal prior for \(\theta\).
Defaults to Inf (uniform prior).
Logical indicating whether for uniform priors, the marginal
posterior should be computed with the hypergeometric function. Defaults
to FALSE (using numerical integration instead).
Additional arguments passed to stats::integrate or
hypergeo::genhypergeo (depending on the hypergeo argument).
Credibility level of the highest posterior density interval.
Defaults to 0.95.
The numerical search range for the effect size. Defaults to
the level*100% confidence inteval range inflated by a factor of
three. We recommend changing this argument only if there are numerical
problems in calculating the HPD interval.
The numerical search range for the lower posterior
quantile of the HPD interval. Defaults to the range between (1 -
level)*0.2 and (1 - level)*0.8. We recommend changing this
argument only if there are numerical problems in calculating the HPD
interval.
Samuel Pawel
postPP, postPPalpha, plotPP
theta <- seq(0, 0.6, 0.001)
margpostdens <- postPPtheta(theta = theta, tr = 0.1, to = 0.2, sr = 0.05, so = 0.05)
plot(theta, margpostdens, type = "l", xlab = bquote("Effect size" ~ theta),
ylab = "Marginal posterior density", las = 1)
Run the code above in your browser using DataLab