postPP {ppRep} | R Documentation |
Posterior density of effect size and power parameter
Description
This function computes the posterior density of effect size
\theta
and power parameter \alpha
assuming a
normal likelihood for original and replication effect estimate. A power
prior for \theta
is constructed by updating an initial
normal prior \theta \sim \mathrm{N}(\code{m}, \code{v})
with the likelihood of the original data raised to the power of
\alpha
. A marginal beta prior \alpha \sim
\mbox{Beta}(\code{x},\code{y})
is assumed.
Usage
postPP(theta, alpha, tr, sr, to, so, x = 1, y = 1, m = 0, v = Inf, ...)
Arguments
theta |
Effect size. Has to be of length one or the same length as
|
alpha |
Power parameter. Has to be of length one or the same length as
|
tr |
Effect estimate of the replication study. |
sr |
Standard error of the replication effect estimate. |
to |
Effect estimate of the original study. |
so |
Standard error of the replication effect estimate. |
x |
Number of successes parameter of beta prior for |
y |
Number of failures parameter of beta prior for |
m |
Mean parameter of initial normal prior for |
v |
Variance parameter of initial normal prior for |
... |
Additional arguments passed to |
Value
Posterior density
Author(s)
Samuel Pawel
See Also
postPPalpha
, postPPtheta
, plotPP
Examples
alpha <- seq(0, 1, length.out = 200)
theta <- seq(0, 0.3, length.out = 200)
parGrid <- expand.grid(alpha = alpha, theta = theta)
postdens <- postPP(theta = parGrid$theta, alpha = parGrid$alpha, tr = 0.1,
sr = 0.05, to = 0.2, so = 0.05)
postdensMat <- matrix(data = postdens, ncol = 200, byrow = TRUE)
filled.contour(x = theta, y = alpha, z = postdensMat,
xlab = bquote("Effect size" ~ theta),
ylab = bquote("Power parameter" ~ alpha), nlevels = 15,
color.palette = function(n) hcl.colors(n = n, palette = "viridis"))