poi.gibbs {SMPracticals} | R Documentation |
Gibbs Sampler for Hierarchical Poisson Model, Practical 11.5
Description
This function implements Gibbs sampling for the hierarchical Poisson model described in Example 11.19 and Practical 11.5 of Davison (2003), which should be consulted for more details.
Usage
poi.gibbs(d, alpha, gamma, delta, I, S)
Arguments
d |
A data frame with vector components |
alpha |
A hyperparameter of the prior density |
gamma |
A hyperparameter of the prior density |
delta |
A hyperparameter of the prior density |
I |
Number of iterations for which sampler is run |
S |
Number of independent replicates of sampler |
Details
This is provided simply so that readers spend less time typing. It is not intended to be robust and general code.
Value
An I x S x (n+1) array containing the successive iterations of the samplers,
for the I iterations, S independent replicates, and n
rate parameters plus the parameter
beta
of the prior distribution.
Author(s)
Anthony Davison (anthony.davison@epfl.ch
)
References
Davison, A. C. (2003) Statistical Models. Cambridge University Press. Practical 11.5.
Examples
## From Practical 11.5:
data(pumps)
system.time( pumps.sim <- poi.gibbs(pumps, alpha=1.8, delta=0.1, gamma=1,
I=1000, S=5) )
par(mfrow=c(2,3))
plot.ts(pumps.sim[,1,1])
acf(pumps.sim[,1,1])
pacf(pumps.sim[,1,1])
plot.ts(pumps.sim[,1,11])
acf(pumps.sim[,1,11])
pacf(pumps.sim[,1,11])