grouplasso_gt_cv_fixedgrid: Choose tuning parameters by crossvalidation for grouplasso...

View source: R/grouplasso.R

grouplasso_gt_cv_fixedgridR Documentation

Choose tuning parameters by crossvalidation for grouplasso logreg when given a fixed grid of lambda values

Description

Choose tuning parameters by crossvalidation for grouplasso logreg when given a fixed grid of lambda values

Usage

grouplasso_gt_cv_fixedgrid(
  Y,
  Z,
  Se,
  Sp,
  X,
  groups,
  lambda.seq,
  n.folds,
  b.init.mat,
  w,
  tol = 0.001,
  maxiter = 500
)

Arguments

Y

Group testing output in the format as output by one of the functions individual.assay.gen, dorfman.assay.gen, or array.assay.gen.

Z

Group testing output in the format as output by one of the functions individual.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.

X

matrix containing the design matrices

groups

a vector indicating to which group each covariate belongs

lambda.seq

sequence of lambda values

n.folds

the number of crossvalidation folds

b.init.mat

matrix of which the columns contain initial values for beta for the values of the tuning parameter in lambda.seq

w

group-specific weights for different penalization of different groups

tol

the convergence tolerance

maxiter

the maximum number of iterations allowed for each fit

Value

a list containing the fits over a grid of lambda values as well as the vector of lambda values

Note that the crossvalidation is carried out using the individual diagnoses as though they were the true individual disease statuses.

Examples

grouplasso_gt_data <- get_grouplasso_data(n = 1000, response = "gt")

grouplasso_gt_grid.out <- grouplasso_gt_grid(Y = grouplasso_gt_data$Y$I,
                                             Z = grouplasso_gt_data$Y$A,
                                             Se = grouplasso_gt_data$Y$Se,
                                             Sp = grouplasso_gt_data$Y$Sp,
                                             X = grouplasso_gt_data$X,
                                             E.approx = grouplasso_gt_data$Y$E.approx,
                                             groups = grouplasso_gt_data$groups,
                                             n.lambda = 10,
                                             lambda.min.ratio = 0.01,
                                             lambda.max.ratio = 0.50,
                                             w  = grouplasso_gt_data$w,
                                             tol = 1e-3,
                                             maxiter = 500,
                                             report.prog = TRUE)

grouplasso_gt_cv_fixedgrid.out <- grouplasso_gt_cv_fixedgrid(Y = grouplasso_gt_data$Y$I,
                                                             Z = grouplasso_gt_data$Y$A,
                                                             Se = grouplasso_gt_data$Y$Se,
                                                             Sp = grouplasso_gt_data$Y$Sp,
                                                             X = grouplasso_gt_data$X,
                                                             groups = grouplasso_gt_data$groups,
                                                             lambda.seq = grouplasso_gt_grid.out$lambda.seq,
                                                             n.folds = 5,
                                                             b.init.mat = grouplasso_gt_grid.out$b.mat,
                                                             w = grouplasso_gt_data$w,
                                                             tol = 1e-3,
                                                             maxiter = 500)

gregorkb/semipadd2pop documentation built on Oct. 2, 2022, 1:37 p.m.