Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sim.halving

Simulation Function for Group Testing Data for the Halving Protocol


Description

Simulates data in group testing form ready to be fit by gtreg.halving.

Usage

sim.halving(x = NULL, gshape = 20, gscale = 2, par,
     linkf = c("logit", "probit", "cloglog"),
     sample.size, group.size, sens = 1, spec = 1,
     sens.ind = NULL, spec.ind = NULL)

Arguments

x

a matrix of user-submitted covariates to simulate the data with, defaults to NULL in which case a gamma distribution is used to generate the covariates automatically

gshape

shape parameter of gamma distribution, must be non-negative, set to be 20 by default

gscale

scale parameter of gamma distribution, must be strictly positive, set to be 2 by default

par

the true coefficients in the linear predictor

sample.size

sample size of simulated data

linkf

a character string specifying one of the three link functions to be used: "logit" (default) or "probit" or "cloglog"

group.size

group size in pooling individual samples

sens

sensitivity of the group tests, set to be 1 by default.

spec

specificity of the group tests, set to be 1 by default.

sens.ind

sensitivity of the individual retests, set to be equal to sens if not specified otherwise.

spec.ind

specificity of the individual retests, set to be equal to spec if not specified otherwise.

Details

sim.halving generates group testing data for the halving protocol. The covariates are either specified by the x argument or they are generated from a gamma distribution with a given gshape and gscale. The individual probabilities are calculated from the covariates, the coefficients given in par, and the link function specified through linkf. The true binary individual responses are then simulated from the individual probabilities. The group, subgroup, and individual retests are simulated using the given sens and spec under the halving protocol.

Value

sim.halving returns a data frame with the following columns:

gres

the group response

x

the covariate

groupn

the group number

ind

the actual individual response

retest

the results of individual retests

subgroup

the subgroup number

Author(s)

Boan Zhang

See Also

Examples

set.seed(46)
gt.data <- sim.halving(par = c(-6, .1), gshape = 17, gscale = 1.4,
               sample.size = 5000, group.size = 5,
               sens = 0.95, spec = 0.95)

binGroup

Evaluation and Experimental Design for Binomial Group Testing

v2.2-1
GPL (>= 3)
Authors
Boan Zhang [aut], Christopher Bilder [aut], Brad Biggerstaff [aut], Frank Schaarschmidt [aut, cre], Brianna Hitt [aut]
Initial release
2018-08-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.