cv.enetgt.grid | R Documentation |
Peforms crossvalidation to select a combination of tuning parameters.
cv.enetgt.grid( cv.fold.data, regime, Se, Sp, lambda.seq, theta.seq, weights, B.INIT, tol = 1e-04, E.approx = FALSE, verbose = FALSE, plot = FALSE )
cv.fold.data |
Output from any of the functions |
regime |
testing regime which must be equal to one of |
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.seq |
Sequence of lambda values at which the weighted elastic net estimator will be computed. |
theta.seq |
Sequence of theta values at which the weighted elastic net estimator will be computed. |
weights |
Vector of weights to be used in weighting the l1 penalty. Default is |
B.INIT |
Array of values to be used to initialize the EM-algorithm at each of the tuning paramter combinations specified in |
tol |
Convergence criterion. |
E.approx |
Logical. If |
verbose |
Logical. If |
plot |
Logical. If |
A list which includes the chosen values of the tuning parameters according to crossvalidation.
N <- 2000 data <- model1(N) X <- data$X Y.true <- data$Y # subject individuals to individual testing Se <- c(.94) # individual testing sensitivities Sp <- c(.95) # individual testing specificities assay.data <- individual.assay.gen(Y.true,Se,Sp,cj=1) Z <- assay.data$Z Y <- assay.data$Y # compute the mle on the individual testing data: mlegt.out <- mlegt(X,Y,Z,Se,Sp) b.mle <- mlegt.out$b.mle # compute adaptive elastic net estimator over a grid of tuning parameter values n.lambda <- 8 n.theta <- 2 enetgt.grid.out <- enetgt.grid(X,Y,Z,Se,Sp,n.lambda,n.theta,weights = 1/abs(b.mle[-1])) # make a choice of the tuning parameter using 3-fold crossvalidation: cv.fold.data <- get.individual.cv.fold.data(X,Y,Z,K=5) cv.enetgt.grid.out <- cv.enetgt.grid(cv.fold.data,"individual", Se, Sp, enetgt.grid.out$lambda.seq, enetgt.grid.out$theta.seq, weights=1/abs(b.mle[-1]), B.INIT=enetgt.grid.out$B.ENET) b.aenet.cv <- enetgt.grid.out$B.ENET[cv.enetgt.grid.out$cv.ind[1],,cv.enetgt.grid.out$cv.ind[2]] b.aenet.cv
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.