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

View source: R/aenetgt.R

enetgt.gridR Documentation

Computes the elastic net estimators with weighted l1 norm on group testing data over a grid of lambda and theta values.

Description

Computes the elastic net estimators with weighted l1 norm on group testing data over a grid of lambda and theta values.

Usage

enetgt.grid(
  X,
  Y,
  Z,
  Se,
  Sp,
  n.lambda = 5,
  n.theta = 3,
  weights = 1,
  tol = 1e-04,
  E.approx = FALSE,
  verbose = FALSE,
  get.SEs = FALSE,
  ridge.include = 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.

n.lambda

Number of lambda values for which to compute the estimator.

n.theta

Number of theta values for which to compute the estimator.

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.

tol

Convergence criterion.

E.approx

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

verbose

Logical. If TRUE then progress is reported after computation of the estimator at each tuning parameter pair.

get.SEs

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

ridge.include

Logical. If TRUE then the sequence of theta values begins with 0 to include the ridge estimator.

Value

A list of output which includes an array B.ENET of solutions over the grid of lambda and theta values.

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 over a grid of lambda and theta values. Only the size of the grid must be given, and the function chooses its own set of lambda and theta values.

Examples

# generate individual covariate values and disease statuses
N <- 2000
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
n.lambda <- 10
n.theta <- 2
# compute the elastic net estimator with weights = 1 over grid of lambda and theta values
enetgt.grid.out <- enetgt.grid(X, Y, Z, Se, Sp, n.lambda, n.theta, weights = 1) 

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