sim_Rs: Simulate data (R, R0, R1, R2, R3 and R4)

View source: R/simulate.R

sim_RsR Documentation

Simulate data (R, R0, R1, R2, R3 and R4)

Description

Simulation function for random variables of interest.

Usage

sim_Rs(theta, pi0, n, alpha0 = 0, alpha = 0, beta = 0, seed = NULL, ...)

Arguments

theta

A numeric that provides the true prevalence of a given disease.

pi0

A numeric that provides the prevalence or proportion of people (in the whole population) who are positive, as measured through a non-random, but systematic sampling (e.g. based on medical selection).

n

A numeric that corresponds to the sample size.

alpha0

A numeric that corresponds to the probability that a random participant has been incorrectly declared positive through the nontransparent procedure. In most applications, this probability is likely very close to zero. Default value is 0.

alpha

A numeric that provides the False Negative (FN) rate for the sample R. Default value is 0.

beta

A numeric that provides the False Positive (FP) rate for the sample R. Default value is 0.

seed

A numeric that provides the simulation seed. Default value is NULL.

...

Additional arguments.

Value

A cpreval_sim object (list) with the structure:

  • R: the number of participants in the survey sample that were tested positive.

  • R0: the number of participants in the survey sample that were tested positive with the first testing device (and are, thus, members of the sub-population).

  • R1: the number of participants in the survey sample that were tested positive with both (medical) testing devices (and are, thus, members of the sub-population).

  • R2: the number of participants in the survey sample that are tested positive only with the first testing device (and are, thus, members of the sub-population).

  • R3: the number of participants in the survey sample that are tested positive only with the second testing device.

  • R4: the number of participants that are tested negative with the second testing device (and are either members of the sub-population and have tested negative with the first testing device or are not members of the sub-population).

  • n: the sample size.

  • alpha: the False Negative (FN) rate for the sample R.

  • beta: the False Positive (FP) rate for the sample R.

  • alpha0: the alpha0 probability (as defined above).

  • ...: additional arguments.

Author(s)

Stephane Guerrier

Examples

# Samples without measurement error
sim_Rs(theta = 3/100, pi0 = 1/100, n = 1500, seed = 18)

# With measurement error
sim_Rs(theta = 3/100, pi0 = 1/100, n = 1500, alpha0 = 0,
alpha = 0.01, beta = 0.05, seed = 18)

pempi documentation built on Oct. 9, 2023, 5:10 p.m.