poi.gibbs | R Documentation |
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.
poi.gibbs(d, alpha, gamma, delta, I, S)
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 |
This is provided simply so that readers spend less time typing. It is not intended to be robust and general code.
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.
Anthony Davison (anthony.davison@epfl.ch
)
Davison, A. C. (2003) Statistical Models. Cambridge University Press. Practical 11.5.
## 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])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.