Learn R Programming

BinaryReplicates (version 1.0.0)

BayesianFit: Fit the Bayesian model for Binary Replicates

Description

Fit the Bayesian model for Binary Replicates

Usage

BayesianFit(
  ni,
  si,
  prior = list(a_FP = 2, b_FP = 2, a_FN = 2, b_FN = 2, a_T = 0.5, b_T = 0.5),
  ...
)

Value

An object of class stanfit returned by rstan::sampling.

The Stan model samples the posterior distribution of the fixed parameters \(p\), \(q\) and \(\theta\). It also generates the latent variables \(T_i\) according to their predictive distribution.

Arguments

ni

Numeric vector of \(n_i\)'s, the total numbers of replicates for each individual

si

Numeric vector of \(s_i\)'s, the numbers of replicates equal to 1 for each individual

prior

A list of prior parameters for the model, see Details.

...

Arguments passed to rstan::sampling (e.g. iter, chains).

Details

The model is a Bayesian model for binary replicates. The prior distribution is as follows:

  • The false positive rate: \(p \sim \text{Beta}(a_{FP}, b_{FP})\)

  • The false negative rate: \(q \sim \text{Beta}(a_{FN}, b_{FN})\)

  • The prevalence: \(\theta \sim \text{Beta}(a_T, b_T)\)

The statistical model considers that the true statuses are the latent $$T_i \sim \text{Bernoulli}(\theta).$$

And, given the true status \(T_i\), the number of positive replicates is $$S_i \sim \text{Binomial}(n_i, T_i(1-q)+(1-T_i)p).$$

See Also

credint, bayesian_scoring, classify_with_scores, bayesian_prevalence_estimate