fecr_stanSimple {eggCounts} | R Documentation |

Models the reduction in faecal egg counts with a simple Bayesian model formulation. The model is for paired design only, and it assumes Poisson distribution for the observed egg counts.

```
fecr_stanSimple(preFEC, postFEC, rawCounts = FALSE,
preCF = 50, postCF = preCF, muPrior, deltaPrior,
nsamples = 2000, nburnin = 1000, thinning = 1, nchain = 2,
ncore = 1, adaptDelta = 0.95, saveAll = FALSE, verbose = FALSE)
```

`preFEC` |
numeric vector. Pre-treatment faecal egg counts. |

`postFEC` |
numeric vector. Post-treatment faecal egg counts. |

`rawCounts` |
logical. If TRUE, |

`preCF` |
positive integer or vector of positive integers. Pre-treatment correction factor(s). |

`postCF` |
positive integer or vector of positive integers. Post-treatment correction factor(s). |

`muPrior` |
named list. Prior for the group mean epg parameter |

`deltaPrior` |
named list. Prior for the reduction parameter |

`nsamples` |
a positive integer. Number of samples for each chain (including burn-in samples). |

`nburnin` |
a positive integer. Number of burn-in samples. |

`thinning` |
a positive integer. Thinning parameter, i.e. the period for saving samples. |

`nchain` |
a positive integer. Number of chains. |

`ncore` |
a positive integer. Number of cores to use when executing the chains in parallel. |

`adaptDelta` |
numeric. The target acceptance rate, a numeric value between 0 and 1. |

`saveAll` |
logical. If TRUE, posterior samples for all parameters are saved in the |

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

The first time each model with non-default priors is applied, it can take up to 20 seconds 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 User Guide.

The default number of samples per chain is 2000, with 1000 burn-in samples. Normally this is sufficient in Stan. If the chains do not converge, one should tune the MCMC parameters until convergence is reached to ensure reliable results.

Prints out the posterior summary of `FECR`

as the reduction, `meanEPG.untreated`

as the mean pre-treatment epg, and `meanEPG.treated`

as the mean after-treatment epg. The posterior summary contains the mean, standard deviation (sd), 2.5%, 50% 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 |

Tea Isler

Craig Wang

`simData2s`

for simulating faecal egg counts data with two samples

```
## load sample data
data(epgs)
## apply paired model with individual efficacy
model <- fecr_stanSimple(epgs$before, epgs$after,
rawCounts = FALSE, preCF = 10)
samples <- stan2mcmc(model$stan.samples)
```

[Package *eggCounts* version 2.3-2 Index]