Commit 434137f7 authored by Poppy Miller's avatar Poppy Miller
Browse files

Added documentation for data sets.

parent fdb2904d
......@@ -3,36 +3,56 @@
\docType{data}
\name{DPModel_impl}
\alias{DPModel_impl}
\title{Builds the source attribution model. Is not intended to be used by a regular user. Developers only here!}
\format{An object of class \code{R6ClassGenerator} of length 24.}
\title{Builds the source attribution model. Is not intended to be used by a regular user.
Developers only here!}
\format{\code{\link{R6Class}} object.}
\usage{
DPModel_impl
}
\arguments{
\item{y}{3D array of [type, time, location] of the number of human cases}
\value{
Object of \code{\link{R6Class}}.
}
\description{
Builds the source attribution model. Is not intended to be used by a regular user.
Developers only here!
}
\section{Fields}{
\item{R}{3D array of normalised relative prevalences for each timepoint [type, source, time]}
\describe{
\item{\code{y}}{3D array of [type, time, location] of the number of human cases}
\item{Time}{a character vector of timepoint ids matching time dimension in y and R}
\item{\code{X}}{3D array of the number of positive samples for each type, source and time
[type, source, time]}
\item{Location}{a character vector of location ids matching location dimension in y}
\item{\code{R}}{3D array of normalised relative prevalences for each timepoint
[type, source, time]}
\item{Prev}{a 2D array (matrix) of [source, time].}
\item{\code{Time}}{a character vector of timepoint ids matching time dimension in y and R}
\item{a_q}{concentration parameter for the DP}
\item{\code{Location}}{a character vector of location ids matching location dimension in y}
\item{a_theta}{shape parameter for the Gamma base distribution for the DP}
\item{\code{Sources}}{a character vector of source ids matching the source dimension in X}
\item{b_theta}{rate parameter for the Gamma base distribution for the DP}
\item{\code{Type}}{a character vector of type ids matching the type dimension in X}
\item{s}{vector giving group allocation for each type for the DP}
\item{\code{prev}}{a 2D array (matrix) of [source, time].}
\item{theta}{vector giving values for each group in the DP}
\item{\code{a_q}}{concentration parameter for the DP}
\item{a_r}{3D array of [type, src, time] for the hyperprior on the relative prevalences R}
}
\description{
Builds the source attribution model. Is not intended to be used by a regular user. Developers only here!
}
\item{\code{a_theta}}{shape parameter for the Gamma base distribution for the DP}
\item{\code{b_theta}}{rate parameter for the Gamma base distribution for the DP}
\item{\code{a_r}}{3D array of [type, src, time] for the hyperprior on the relative prevalences R}
\item{\code{a_alpha}}{3D array of [source, time, location] for the prior on the alpha parameters}
\item{\code{s}}{vector giving initial group allocation for each type for the DP}
\item{\code{theta}}{vector giving initial values for each group in the DP}
\item{\code{alpha}}{3D array of [source, time, location] giving initial values for the alpha
parameters}
}}
\keyword{datasets}
......@@ -216,8 +216,8 @@ divided by the number of negative samples) \eqn{j}
\deqn{r_{ijt}} is the unknown relative occurrence of type \eqn{i} on source \eqn{j}.
\emph{Priors}
\deqn{r_{.jt}\sim Dirichlet(a_r_{1jt},..., a_r_{njt})}
\deqn{a_{tl}\sim Dirichlet(a_alpha_{1tl},..., a_alpha_{mtl})}
\deqn{r_{.jt}\sim Dirichlet(a\_r_{1jt},..., a\_r_{njt})}
\deqn{a_{tl}\sim Dirichlet(a\_alpha_{1tl},..., a\_alpha_{mtl})}
\deqn{q\sim DP(a_q, Gamma(a_{theta},b_{theta}))}
}
}
......@@ -235,19 +235,19 @@ res <- HaldDP$new(data = campy, k = prevs, priors = priors, a_q = 1)
res$fit_params(n_iter = 100, burn_in = 10, thin = 1)
res$update()
res$print_data()
res$print_inits()
res$print_priors()
res$print_acceptance()
res$print_fit_params()
dat <- res$print_data()
init <- res$print_inits()
prior <- res$print_priors()
acceptance <- res$print_acceptance()
fit_params <- res$print_fit_params()
res$plot_heatmap(iters = 10:100, hclust_method = "complete")
res$summary(params = c("alpha", "q", "lambda_i"),
summarys <- res$summary(params = c("alpha", "q", "lambda_i"),
times = "1", sources = c("ChickenA", "Bovine"),
iters = 10:100, flatten = TRUE, CI_type = "chen-shao")
res$extract(params = c("alpha", "r", "q", "lambda_j"),
posteriors <- res$extract(params = c("alpha", "r", "q", "lambda_j"),
sources = c("ChickenB", "Ovine"),
types = c("474", "52"),
iters = 50:100, drop = FALSE, flatten = FALSE)
......@@ -256,9 +256,11 @@ res$extract(params = c("alpha", "r", "q", "lambda_j"),
Chris Jewell and Poppy Miller \email{p.miller at lancaster.ac.uk}
}
\references{
Chen, M.-H. and Shao, Q.-M. (1998). Monte Carlo estimation of Bayesian credible and HPD intervals, \emph{Journal of Computational and Graphical Statistics}, 7.
Chen, M.-H. and Shao, Q.-M. (1998). Monte Carlo estimation of Bayesian
credible and HPD intervals, \emph{Journal of Computational and Graphical Statistics}, 7.
Liu Y, Gelman A, Zheng T (2015). "Simulation-efficient shortest probability intervals." Statistics and Computing.
Liu Y, Gelman A, Zheng T (2015). "Simulation-efficient shortest probability
intervals." Statistics and Computing.
}
\keyword{datasets}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment