p.model {bayescount}R Documentation

ANALYSE COUNT DATA USING JAGS

Description

Apply a Bayesian Poisson model to count data to return probable values for mean count. Usually called internally from the bayescount function, but can be called directly by the user (although there is significantly less user-proofing for using this function directly than for bayescount). Convergence is assessed by calculating the Gelman-Rubin statistic. Requires Just Another Gibbs Sampler (JAGS). *THIS SOFTWARE IS INTENDED FOR EDUCATIONAL PURPOSES ONLY AND SHOULD NOT BE RELIED UPON FOR REAL WORLD APPLICATIONS*

Usage

p.model(data, name, jags = "jags", burnin = 5000, 
   updates = 10000, ml.equivalent = FALSE)

Arguments

data an existing integer vector containing the data. No default.
name a name for the analysis (character string). No default.
jags the system call or path for activating JAGS. Default for Linux is 'jags', in Windows try 'C:/JAGS-0.90/jags.exe' etc.
burnin the number of burnin iterations (not sampled) to use (numeric). Default 5000 iterations.
updates the number of sampling iterations to use (numeric). Default 10000 iterations.
ml.equivalent should the function also produce results that are equivalent to the log likelihood output of many maximum likelihood models (eg. the R package 'zicounts')? (logical) If TRUE, an additional 9 columns of data are produced. Default FALSE.

Value

The results of the simulation are returned as a vector of length 14 or 23 (depending on 'ml.equivalent'), containing the following:

1 name
2 convergence successful (1 or 0)
3 model crashed (1 or 0)
4 error in model (1 or 0)
5 number of sampling iterations achieved
6 lower 95 percent confidence interval estimate for mean count
7 median estimate for mean count
8 upper 95 percent confidence interval estimate for mean count
9 lower 95 percent CI for zero-inflation
10 median for zero-inflation
11 upper 95 percent CI for zero-inflation
12 lower 95 percent CI for overdispersion
13 median for overdispersion
14 upper 95 percent CI for overdispersion
15 lower 95 percent confidence interval estimate for log(mean)
16 median estimate for log(mean)
17 upper 95 percent confidence interval estimate for log(mean)
18 lower 95 percent CI for logit(zero-inflation)
19 median for logit(zero-inflation)
20 upper 95 percent CI for logit(zero-inflation)
21 lower 95 percent CI for log(mean/overdispersion)
22 median for log(mean/overdispersion)
23 upper 95 percent CI for log(mean/overdispersion)

Author(s)

Matthew Denwood m.denwood.1@research.gla.ac.uk, funded as part of the DEFRA VTRI project 0101.

See Also

bayescount gp.model zip.model zigp.model

Examples

# run an analysis named 'test' on a dataframe object 'mydata', with all model values as default, and save the results to 'myresults':

mydata <- c(5,3,7,9,5,6,2,1,6,5)
myresults <- p.model(name="test", data=mydata)


[Package bayescount version 0.5.1 Index]