ci.bayes.normal: Bayesian credible interval for a normal prior distribution

View source: R/statpsych1.R

ci.bayes.normalR Documentation

Bayesian credible interval for a normal prior distribution

Description

Computes an approximate Bayesian credible interval for a normal prior distribution. This function can be used with any parameter estimator (e.g., mean, mean difference, linear contrast of means, slope coefficient) that has a normal sampling distribution. The mean and standard deviation of the posterior normal distribution are also reported.

Usage

ci.bayes.normal(alpha, prior.mean, prior.sd, est, se)

Arguments

alpha

alpha level for 1-alpha credibility interval

prior.mean

mean of prior Normal distribution

prior.sd

standard deviation of prior Normal distribution

est

sample estimate

se

standard error of sample estimate

Value

Returns a 1-row matrix. The columns are:

  • Posterior mean - posterior mean of Normal distributoin

  • Posterior SD - posterior standard deviation of Normal distributoin

  • LL - lower limit of the credible interval

  • UL - upper limit of the credible interval

References

\insertRef

Gelman2004statpsych

Examples

ci.bayes.normal(.05, 30, 2, 24.5, 0.577)

# Should return:
#      Posterior mean Posterior SD       LL       UL
# [1,]        24.9226    0.5543895 23.83602 26.00919



statpsych documentation built on July 9, 2023, 6:50 p.m.