Gibbs.ANOVA: Gibbs sampler

Description Usage Arguments Value Author(s) References Examples

View source: R/Gibbs.ANOVA.R

Description

Samples from the posterior distribution of the data by means of a Gibbs sampler (derived from Lynch, 2007, p. 170-172).

Usage

1
Gibbs.ANOVA(data,it=5000,burnin=500,seed=0)

Arguments

data

a data frame with a variable y and a variable g, where y is the dependent variable, and g is the grouping variable for the ANOVA. Groups are labeled consecutively, starting at 1.

it

the number of (post-burnin) iterations for each of the two chains. The default uses 5.000 iterations.

burnin

the number of iterations for the function to use for the burnin phase in each of the two chains. The default uses 500 burnin iterations.

seed

integer; seed value. If seed==0, no seed is set.

Value

posterior

a matrix with all samples from the posterior for each parameter.

Returns a matrix with the mean, median, and standard deviation (in columns) for the it samples from the conditional posterior distributions of the group means and pooled standard deviation (rows).

Produces traceplots of each parameter and the associated samples from the posterior distribution.

Author(s)

M. A. J. Zondervan-Zwijnenburg

References

Lynch, S. (2007). Introduction to applied Bayesian statistics and estimation for social scientists. New York, NY: Springer. doi: 10.1007/978-0-387-71265-9

Zondervan-Zwijnenburg, M.A.J., Van de Schoot, R., & Hoijtink, H. (2017). Testing ANOVA replication by means of the prior predictive p-value.

Examples

1
2

Example output

Loading required package: quadprog
Loading required package: shiny
           mean   median     sd
Mean 1 102.5411 102.6336 4.7111
Mean 2 122.5605 122.5372 6.3180
Mean 3 142.9103 142.8860 6.4078
Mean 4 135.2820 135.2768 6.4514
SD      69.4834  69.4127 2.0728

ANOVAreplication documentation built on Sept. 27, 2021, 9:06 a.m.