enetgt: Computes the elastic net estimator with weighted l1 norm on...

View source: R/aenetgt.R

enetgtR Documentation

Computes the elastic net estimator with weighted l1 norm on group testing data.

Description

Computes the elastic net estimator with weighted l1 norm on group testing data.

Usage

enetgt(
  X,
  Y,
  Z,
  Se,
  Sp,
  lambda,
  theta,
  weights = 1,
  binit = NULL,
  tol = 1e-04,
  E.approx = FALSE,
  get.SEs = FALSE
)

Arguments

X

Design matrix with first column a column of 1s.

Y

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

Z

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

Se

A vector of testing sensitivities, where the first element is the testing specificity for pools and the second entry is the test specificity for individual testing, if applicable.

Sp

A vector of testing specificities, where the first element is the testing specificity for pools and the second entry is the test specificity for individual testing, if applicable.

lambda

Tuning parameter.

theta

Ridge versus lasso penalty mixer.

weights

Vector of weights to be used in weighting the l1 penalty. Default is weights=1, which causes equal weights to be used for each coefficient.

binit

Initial values for EM-algorithm.

tol

Convergence criterion.

E.approx

Logical. If TRUE then E-step done with EYapprox(). If FALSE, then E-step done with EYexact().

get.SEs

Logical. If TRUE then estimated standard errors for the estimates are returned.

Value

The elastic net estimator with weighted l1 norm under the choices of lambda, theta, and weights.

This function implements a penalized EM-algorithm to find the elastic net estimator with weighted l1 norm based on the observed data X, Y, Z, and the sensitivities and specificities in Se, Sp.

Examples

# generate individual covariate values and disease statuses
N <- 5000
data <- model1(N)
X <- data$X
Y.true <- data$Yi
Se <- c(.95) # set individual assay sensitivity
Sp <- c(.97) # set individual assay specificity
cj <- 1 # set size of master pools
# subject individuals to individual testing
assay.data <- individual.assay.gen(Y.true,Se,Sp,cj)
Z <- assay.data$Z
Y <- assay.data$Y
# compute the elastic net estimator with weights = 1
enetgt.out <- enetgt(X, Y, Z, Se, Sp, lambda=10, theta=.5, weights = 1) 
# compute adaptive elastic net with weights from the elastic net estimator
a.enetgt.out <- enetgt(X, Y, Z, Se, Sp, lambda=.5, theta=.5, 
                       weights = 1/abs(enetgt.out$b.enet[-1])) 

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