Learn R Programming

BinaryReplicates (version 1.0.0)

non_bayesian_scoring: Non-Bayesian scoring methods

Description

Compute the average-, median- and likelihood-based scores

Usage

average_scoring(ni, si)

median_scoring(ni, si)

likelihood_scoring(ni, si, param)

MAP_scoring(ni, si, fit)

Value

A numeric vector of the scores

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

param

A list with 3 entries: theta The probability that \(T=1\), i.e., the prevalence, p The false positive rate, q The false negative rate.

fit

The object returned by EMFit containing the results of the EM algorithm

See Also

EMFit

Examples

Run this code
data("periodontal")
Y_A <- average_scoring(periodontal$ni, periodontal$si)
Y_M <- median_scoring(periodontal$ni, periodontal$si)
# In order to compute the likelihood-based scores, we need to know theta,
# p and q which can be estimated in this example as follows:
theta_hat <- mean(periodontal$ti)
cat("The prevalence in the data is ", theta_hat, "\n")
p_hat <- with(periodontal, sum(si[ti == 0]) / sum(ni[ti == 0]))
q_hat <- with(periodontal, 1 - sum(si[ti == 1]) / sum(ni[ti == 1]))
Y_L <- likelihood_scoring(periodontal$ni, periodontal$si,
                          list(theta = theta_hat, p = p_hat, q = q_hat))

data("periodontal")
Y_M <- median_scoring(periodontal$ni, periodontal$si)

data("periodontal")
fit <- EMFit(periodontal$ni, periodontal$si)
Y_MAP <- MAP_scoring(periodontal$ni, periodontal$si, fit)

Run the code above in your browser using DataLab