Fits a generalized linear model via penalized maximum likelihood and cross-validation. Then, compute the difference statistic $$W_j = |Z_j| - |\tilde{Z}_j|$$ where \(Z_j\) and \(\tilde{Z}_j\) are the coefficient estimates for the jth variable and its knockoff, respectively. The value of the regularization parameter \(\lambda\) is selected by cross-validation and computed with glmnet.

stat_modelY_coef(X, Y, Yk, generate_lambda = TRUE, nlambda = 100, nfolds = 5)

Arguments

X

n-by-p matrix of quantitative predictors.

Y

n-by-r matrix of original responses.

Yk

n-by-r matrix of knockoff responses.

generate_lambda

whether to use the method in the YKnock paper to generate lambda sequence. If not, it will use the method of glmnet package to generate lambda.

nlambda

The number of lambda values - default is 100.

nfolds

number of folds - default is 5.

Details

This function uses the glmnet package to fit a generalized linear model via penalized maximum likelihood.

The statistics \(W_j\) are constructed by taking the difference between the coefficient of the j-th responses and its knockoff.

By default, the value of the regularization parameter is chosen by 5-fold cross-validation.

The optional nlambda parameter can be used to control the granularity of the grid of \(\lambda\)'s. The default value of nlambda is 100.