Description Usage Arguments Value See Also Examples

Apply a Bayesian (zero-inflated) (gamma / Weibull / lognormal / independant / simple) Poisson model to count data to return possible values for mean count, variance, shape paramater, scale parameter (overdispersion or 'k') and zero-infaltion where appropriate to the model selected. This function generates the model specifications and starting values, and is used by the higher level functions bayescount and bayescount.single, but can also be called directly.

1 2 3 4 |

`data` |
an existing R vector containing the data (integer vector). No default. |

`model` |
model to use. Choices are "GP" (gamma Poisson = negative binomial), "ZIGP" (zero-inflated gamma Poisson = zero-inflated negative binomial), "LP" (lognormal Poisson), "ZILP" (zero-inflated lognormal Poisson), "WP" (Wiebull Poisson), "ZIWP" (zero-inflated Weibull Poisson), "SP" (simple Poisson), "ZISP" (zero-inflated simple Poisson) or "IP" (independant Poisson). The simple Poisson model forces each count to have the same mean, wheras the independant Poisson process allows each count to have an unrelated mean (therefore a zero-inflated version is not possible). Default "ZILP". |

`call.jags` |
should the function run the model using run.jags? If TRUE, the model is run and the results are returned, otherwise a compiled but not updated object of class |

`alt.prior` |
should the model run the [ZI] [WP|GP|LP] models using the standard or the alternative prior distribution for variance? (logical) Can also be a character value of a user-specified prior distribution. Default FALSE. Where information concerning overdispersion in the data is sparse, the choice of prior distribution will have an affect on the posterior distribution for ALL parameters. It is recommended to run a simulation using both types of prior when working with small datasets, to make sure results are consistent. |

`monitor.lambda` |
should the model or model specification monitor the mean of the Poisson process for each datapoint? This is required to calculate the likelihood for the Independant Poisson model only, but may be useful for other purposes. Default FALSE. |

`monitor.deviance` |
option to monitor the deviance of the model (using the built-in 'deviance' monitor). Default FALSE. |

`...` |
additional arguments to be passed directly to |

An object of class `runjags-class`

1 2 3 4 5 6 7 8 9 10 11 12 | ```
# Return the model specification and starting values for a
# lognormal Poisson, then run the model using run.jags:
## Not run:
data <- rpois(100, rlnorm(3, 0.2))
model <- run.model(model="LP", data=data, call.jags=FALSE)
library('runjags')
results <- extend.jags(model, burnin=5000, sample=10000)
## End(Not run)
``` |

bayescount documentation built on May 29, 2017, 5:01 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.