View source: R/anova_glmnet_single.R
anova_glmnet_single | R Documentation |
glmnet
modelGiven a sparse glmnet
model (not ridge regression), here we assing ANOVA type-II -log10 p-values to a single submodel obtained by specifying providing the cross-validation glmnet
object and specifying index as "min" or "1se" (see glmnet::cv.glmnet()
return object), or alternatively only the beta
matrix (sparse coefficients) and the numeric index of the lambda
penalty factor.
To achieve this, each set of selected loci is fit again to the original data without penalization.
anova_glmnet_single( X, y, pcs = NULL, obj_cv = NULL, beta = NULL, index = "min", ret_sparse = FALSE )
X |
The genotype matrix.
Same as was used in |
y |
The trait vector.
Same as was used in |
pcs |
The PC (eigenvector) matrix (optional).
Same as was used in |
obj_cv |
Optional, the cross-validation object produced by |
beta |
Optional, the sparse matrix of coefficients (component |
index |
The index for the desired |
ret_sparse |
Logical that controls return value (see that). |
If ret_sparse = FALSE
(default), returns a complete vector of scores (-log10 p-values) for every locus in X
, with zeroes for all loci with zero coefficients.
For loci with non-zero coefficients, p-values are calculated using anova2()
, see that for more details.
If ret_sparse = TRUE
, returns a list of indexes and scores corresponding only to the loci with non-zero coefficients.
glmnet_pca()
, particularly option cv = TRUE
, for obtaining cross-validation objects with PCs.
anova_single()
for scoring a model specified by locus indexes only.
anova_glmnet()
for a version that calculates scores for all models (all lambdas), though it is much slower and not generally recommended.
anova2()
for additional details and data restrictions.
scores_glmnet()
for a different way of scoring/raking variants.
## Not run: # version with cross-validation object `obj_cv` (recommended) # defaults to selecting model with lowest cross-validation error (`index = "min"`) scores <- anova_glmnet_single( X, y, pcs, obj_cv = obj_cv ) # version with beta matrix and desired index scores <- anova_glmnet_single( X, y, pcs, beta = beta, index = 50 ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.