gesso.coefnum {gesso} | R Documentation |
Get model coefficients with specified number of non-zero interactions
Description
A function to obtain coefficients with target_b_gxe_non_zero
specified to control the desired sparsity of interactions in the model.
Usage
gesso.coefnum(cv_model, target_b_gxe_non_zero, less_than = TRUE)
Arguments
cv_model |
cross-validated model fit object obtained by using function |
target_b_gxe_non_zero |
number of non-zero interactions we want to inlcude in the model |
less_than |
|
Value
A list of model coefficients corresponding to the best model that contains at most or at least target_b_gxe_non_zero
non-zero interaction terms.
The target model is selected based on the averaged cross-validation (cv) results: for each pair of parameters lambda
=(lambda_1, lambda_2) in the grid and each cv fold we obtain a number of non-zero estimated interaction terms, then average cv results by lambda
and choose the tuning parameters corresponding to the minimum average cv loss that have at most or at least target_b_gxe_non_zero
non-zero interaction terms. Returned coefficients are obtained by fitting the model on the full data with the selected tuning parameters.
Note that the number of estimated non-zero interactions will only approximately reflect the numbers obtained on cv datasets.
beta_0 |
estimated intercept value |
beta_e |
estimated environmental coefficient value |
beta_g |
a vector of estimated main effect coefficients |
beta_gxe |
a vector of estimated interaction coefficients |
beta_c |
a vector of estimated confounders coefficients |
Examples
data = data.gen()
model = gesso.cv(data$G_train, data$E_train, data$Y_train)
model_coefficients = gesso.coefnum(model, 5)
gxe_coefficients = model_coefficients$beta_gxe; sum(gxe_coefficients!=0)