post.pred.check: post.pred.check

Description Usage Arguments Details Value Author(s) Examples

View source: R/bayes.anova.R

Description

Provides a posterior predictive check for a fitted Bayesian ANOVA model.

Usage

1
post.pred.check(anovafit, ngroups, out, reps = 50, eta)

Arguments

anovafit

A dataframe returned by bayes.anova

ngroups

An integer which is the number of groups used in the ANOVA

out

A numerical vector containing the originally observed data in all groups

reps

An integer which is the number of posterior predictive distributions sampled from the ANOVA models posterior distribution. Defaults to 50 sampled parameters.

eta

A numerical vector containing the weight values of the mixture.

Details

Provides a posterior predictive check for a fitted Bayesian ANOVA model.

Value

Produces a plot consisting of a density estimate of the original data and posterior predictive distributions sampled from the posterior of the Bayesian ANOVA model as density overlays.

Author(s)

Riko Kelter

Examples

1
2
3
4
5
6
7
set.seed(700)
x1=rnorm(1000,0,1)
x2=rnorm(1000,1,1)
x3=rnorm(1000,2,2)

result=bayes.anova(n=1000,first = x1, second=x2, third=x3)
post.pred.check(result, ngroups = 3, out = c(x1,x2,x3), reps = 25, eta = c(1/3,1/3,1/3))

Example output

Bayesian ANOVA output:
Details: Gaussian-mixture model with three components


|Parameter     |LQ    |Mean  |UQ    |Std.Err |
|:-------------|:-----|:-----|:-----|:-------|
|mu1           |-0.05 |-0.05 |-0.04 |0       |
|mu2           |1.02  |1.02  |1.03  |0       |
|mu3           |2.1   |2.11  |2.12  |0       |
|sigma1        |1.05  |1.09  |1.14  |0.02    |
|sigma2        |1.05  |1.1   |1.14  |0.02    |
|sigma3        |1.98  |2.07  |2.17  |0.05    |
|mu2-mu1       |1.07  |1.07  |1.07  |0       |
|mu3-mu1       |2.15  |2.16  |2.17  |0       |
|mu3-mu2       |1.08  |1.09  |1.1   |0       |
|sigma2-sigma1 |-0.06 |0     |0.07  |0.03    |
|sigma3-sigma1 |0.88  |0.98  |1.09  |0.05    |
|sigma3-sigma2 |0.88  |0.98  |1.09  |0.05    |
|delta12       |-1.04 |-1.02 |-1.01 |0.01    |
|delta13       |-1.74 |-1.72 |-1.68 |0.01    |
|delta23       |-0.88 |-0.86 |-0.85 |0.01    |

bayesanova documentation built on July 2, 2020, 2:29 a.m.