Learn R Programming

mcsm (version 1.0)

randomeff: Gibbs sampler for a one-way random effect model

Description

This function describes a Gibbs sampler for the one-way random effect model for the Energy dataset provided with the mcsm package. The prior is made of conjugate distributions, i.e. normal and inverted gamma distributions.

Usage

randomeff(nsim = 10^3, a = 10, b = 30)

Arguments

nsim
Number of Gibbs iterations
a
Common shape parameter for the inverted variances
b
Common scale parameter for the inverted variances

Value

This function produces a plot made of six histograms corresponding to the six parameters of the model $mu$, $theta1$, $theta2$, $sqrt(sigma2mu)$, $sqrt(tau2)$, and $sqrt(sigma2)$, eliminating the first $10%$ of the simulations as burnin.

References

Chapter 7 of EnteR Monte Carlo Statistical Methods

Examples

Run this code
data(Energy)
randomeff(10^4,a=1,b=1)

Run the code above in your browser using DataLab