EYapprox: Approximates the conditional expectations of individual...

View source: R/aenetgt.R

EYapproxR Documentation

Approximates the conditional expectations of individual disease statuses with Gibbs sampling.

Description

Approximates the conditional expectations of individual disease statuses with Gibbs sampling.

Usage

EYapprox(Z, Y, X, b, Se, Sp, GI = 5000)

Arguments

Z

Group testing output from one of the functions individual.assay.gen, masterpool.assay.gen, dorfman.assay.gen, or array.assay.gen.

Y

Group testing output from one of the functions individual.assay.gen, masterpool.assay.gen, dorfman.assay.gen, or array.assay.gen.

X

Design matrix with first column a column of 1s.

b

Parameter values at which to compute the conditional expectations.

Se

A vector of testing sensitivities of length max(Z[,3]).

Sp

A vector of testing specificities of length max(Z[,3]).

GI

The length of the Gibbs sampling Markov chain.

Value

The vector of conditional expectations.

This function uses a Gibbs sampler to appriximate the conditional expectation of each individual's disease status, conditional on the observed assay data and the disease statuses of all other individuals. This function is used in the EM algorithm performed by the functions mlegt, enetgt, enetgt.grid, and enetgt.grid.0 under array testing.

Examples

# generate individual covariate values and disease statuses
N <- 100
data <- model1(N)
X <- data$X
Y.true <- data$Yi
Se <- c(.95,.92) # set master pool and individual assay sensitivity
Sp <- c(.97,.98) # set master pool and individual assay specificity
cj <- 4 # set size of master pools
# subject individuals to array testing
assay.data <- array.assay.gen(Y.true,Se,Sp,cj)
Z <- assay.data$Z
Y <- assay.data$Y
b <- data$b
EY <- EYapprox(Z,Y,X,b,Se,Sp,GI=5000)

gregorkb/aenetgt documentation built on Oct. 12, 2022, 11:51 a.m.