Models faecal egg counts data in a one-sample case with (zero-inflated) Poisson-gamma model formulation using the Stan modelling language. It is computationally several-fold faster compare to conventional MCMC techniques. For the installation instruction of Stan, please read: Stan Installation.

1 2 3 4 |

`fec` |
vector of faecal egg counts |

`rawCounts` |
logical. If true, |

`CF` |
correction factor or vector of correction factors |

`zeroInflation` |
logical. If true, uses the model with zero-inflation. Otherwise uses the model without zero-inflation |

`muPrior` |
a list with hyper-prior information for the baseline mean parameter |

`kappaPrior` |
a list with hyper-prior information for the dispersion parameter |

`phiPrior` |
a list with hyper-prior information for zero-inflation parameter. The default prior is |

`nsamples` |
a positive integer specifying how many iterations for each chain (including burn-in samples) |

`nburnin` |
number of burn-in samples |

`thinning` |
thinning parameter, a positive integer specifying the period for saving samples |

`nchain` |
a positive integer specifying the number of chains |

`ncore` |
number of cores to use when executing the chains in parallel |

`adaptdelta` |
the target acceptance rate, a value between 0 and 1 |

`verbose` |
logical. If true, prints progress and debugging information |

The first time each non-default model is applied, it can take up to 20 seconds for stan to compile the model. Currently the function only support prior distributions with two parameters. For a complete list of supported priors and their parameterization, please consult the list of distributions in Stan.

Sometimes the function outputs informational message from Stan regarding the Metropolis proposal rejections, this is due to the sampler hit the boundary of the parameter space. For some variables, the boundary point is not supported in the distribution. This is not a concern if there are only a few such warnings.

Prints out summary of `meanEPG`

as the posterior mean egg count. The posterior summary contains the mean, standard deviation (sd), 2.5%, 25%, 50%, 75% and 97.5% percentiles, the 95% highest posterior density interval (HPDLow95 and HPDHigh95) and the posterior mode. NOTE: we recommend to use the 95% HPD interval and the mode for further statistical analysis.

The returned value is a list that consists of:

`stan.samples` |
An object of S4 class |

`posterior.summary` |
A data frame that is the same as the printed posterior summary. |

Craig Wang craig.wang@uzh.ch

`simData1s`

for simulating faecal egg count data with one sample

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
## Not run:
## load the sample data as a vector
data(echinococcus)
fec<-echinococcus[[1]]
## apply zero-infation model to the data vector
model<-fec_stan(fec,rawCounts=FALSE,CF=50,zeroInflation=FALSE)
samples<-stan2mcmc(model$stan.samples)
## a demonstration
demo("fecm_stan", package = "eggCounts")
## End(Not run)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

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.