bayes.anova {bayesanova} | R Documentation |
bayes.anova
Description
This function runs a Bayesian analysis of variance (ANOVA) on the data. The Bayesian ANOVA model assumes normally distributed data in all three groups, and conducts inference based on a Gibbs sampler in a three-component Gaussian-mixture with unknown parameters.
Usage
bayes.anova(n=10000,first,second,third,fourth=NULL,fifth=NULL,sixth=NULL,
hyperpars="custom",burnin=n/2,sd="sd",q=0.1,ci=0.95)
Arguments
n |
Number of posterior draws the Gibbs sampler produces. The default is |
first |
Numerical vector containing the values of the first group |
second |
Numerical vector containing the values of the second group |
third |
Numerical vector containing the values of the third group |
fourth |
Numerical vector containing the values of the fourth group. Default value is NULL. |
fifth |
Numerical vector containing the values of the fifth group. Default value is NULL. |
sixth |
Numerical vector containing the values of the sixth group. Default value is NULL. |
hyperpars |
Sets the hyperparameters on the prior distributions. Two options are provided. The default is |
burnin |
Burn-in samples for the Gibbs sampler |
sd |
Selects if posterior draws should be produced for the standard deviation (default) or the variance. The two options are |
q |
Tuning parameter for the hyperparameters. The default is |
ci |
The credible level for the credible intervals produced. Default is |
Details
The Gibbs sampler is run with four Markov chains to run convergence diagnostics.
Value
Returns a dataframe which includes four columns for each parameter of interest. Each column corresponds to the posterior draws of a single Markov chain obtained by the Gibbs sampling algorithm.
Author(s)
Riko Kelter
References
For details, see: https://arxiv.org/abs/1906.07524v1
Examples
set.seed(42)
x1=rnorm(75,0,1)
x2=rnorm(75,1,1)
x3=rnorm(75,2,1)
x4=rnorm(75,-1,1)
result=bayes.anova(first=x1,second=x2,third=x3)
result=bayes.anova(n=1000,first=x1,second=x2,third=x3,
hyperpars="custom",burnin=750,ci=0.99,sd="sd")
result2=bayes.anova(n=1000,first=x1,second=x2,third=x3,
fourth=x4)