postPPtheta {ppRep}R Documentation

Marginal posterior distribution of effect size

Description

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}).

Usage

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),
  ...
)

Arguments

theta

Effect size. Can be a vector.

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 for beta prior of power parameter \alpha. Defaults to 1. Is only taken into account when alpha = NA.

y

Number of failures parameter for beta prior of power parameter \alpha. Defaults to 1. Is only taken into account when alpha = NA.

alpha

Power parameter. Can be set to a number between 0 and 1. Defaults to NA (a beta prior on the power parameter).

m

Mean parameter of initial normal prior for \theta. Defaults to 0.

v

Variance parameter of initial normal prior for \theta. Defaults to Inf (uniform prior).

hypergeo

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).

level

Credibility level of the highest posterior density interval. Defaults to 0.95.

thetaRange

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.

quantileRange

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.

Value

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).

Author(s)

Samuel Pawel

See Also

postPP, postPPalpha, plotPP

Examples

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)

[Package ppRep version 0.42.3 Index]