sim.g {binGroup}R Documentation

Simulation Function for Group Testing Data

Description

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

Usage

sim.g(gshape = 20, gscale = 2, beta.par, number.sample, 
group.size, sens = 1, spec = 1)

Arguments

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
beta.par the true coefficients in the linear predictor
number.sample sample size of simulated data
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.

Details

sim.g generates group testing data in simple pooling form. To begin, the covariates are generated from a gamma distribution with given gshape and gscale. The individual probabilities are calculated with these covariates and the logit link using coefficients given in beta.par. The true individual responses are simulated next using Bernoulli distributions with these corresponding individual probabilities. The individual responses and their corresponding covariates are ordered (by covariate) and pooled into groups by the specified group.size. The true group responses are found from the individual responses within the groups (i.e., if at least one response is positive, the group is positive; otherwise, the group response is negative). Finally, the observed group responses are simulated from Bernoulli distributions using the given sens and spec values. Note that with the given group size, the last group may have less individuals.

Value

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

groupres the group response
x the covariate
gnum the group number
ind the actual individual response

Author(s)

Boan Zhang

See Also

gtreg, gtreg.mp

Examples


set.seed(1125)
gt.data<-sim.g(beta.par=c(-9,0.1), number.sample=279, group.size=9)


[Package binGroup version 1.0-4 Index]