Learn R Programming

BinaryReplicates (version 1.0.0)

prevalence_estimate: Compute the average-/median- or MAP-based prevalence estimates based on the scores

Description

Compute the average-/median- or MAP-based prevalence estimates based on the scores

Usage

prevalence_estimate(scores)

Value

A numeric value of the prevalence estimate

Arguments

scores

Numeric vector of the scores, computed with average_scoring, median_scoring or MAP_scoring

Examples

Run this code
data("periodontal")
theta <- mean(periodontal$ti)
Y_A <- average_scoring(periodontal$ni, periodontal$si)
Y_M <- median_scoring(periodontal$ni, periodontal$si)
fit <- EMFit(periodontal$ni, periodontal$si)
Y_MAP <- MAP_scoring(periodontal$ni, periodontal$si, fit)
hat_theta_A <- prevalence_estimate(Y_A)
hat_theta_M <- prevalence_estimate(Y_M)
hat_theta_MAP <- prevalence_estimate(Y_MAP)
cat("The average-based prevalence estimate is ", hat_theta_A, "\n")
cat("The median-based prevalence estimate is ", hat_theta_M, "\n")
cat("The MAP-based prevalence estimate is ", hat_theta_MAP, "\n")
cat("The prevalence in the dataset is ", theta, "\n")

Run the code above in your browser using DataLab