Gibbs sampler for a one-way normal random effects model with a semi-conjugate prior

Description

Simulates realisations from the posterior distribution for the population mean, random effect means and precision components in a one-way normal random effects model with a semi-conjugate prior

Usage

1
  gibbsReffects(N, initial, priorparam, m, n, ybar, s)

Arguments

N

length of MCMC chain

initial

starting values for the population mean and the precision components

priorparam

prior parameters a,b,c,d,e,f

m

number of treatments

n

vector containing the number of observations on each treatment

ybar

vector containing the mean of observations on each treatment

s

vector containing the standard deviation of observations on each treatment

Examples

1
2
3
4
5
data(contamination)
n=tapply(contamination$acc,contamination$keyboard,length)
ybar=tapply(contamination$acc,contamination$keyboard,mean)
s=sqrt(tapply(contamination$acc,contamination$keyboard,var)*(n-1)/n)
mcmcAnalysis(gibbsReffects(N=100,initial=c(200,2e-5,1),priorparam=c(200,0.1,0.1,0.1,0.1,0.1),m=10,n=n,ybar=ybar,s=s))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.