elastic_net function

Elastic Net Penalization Model Estimation

Elastic Net Penalization Model Estimation

Function to fit the elastic net penalization model to the data. This model penalizes the interaction between the covariates and the treatment but leaves unpenalized the main effects.

elastic_net( resp, trt, subgr, covars, data, resptype = c("survival", "binary"), alpha, status = NULL )

Arguments

  • resp: (string)

    the response variable name.

  • trt: (string)

    the treatment variable name. The treatment variable must be a factor with 2 levels where the first level is the control and the second one the treatment.

  • subgr: (character)

    vector with the name of the subgroup variables from which we want to obtain the subgroup treatment effect. They have to be factor variables with the subgroups as levels.

  • covars: (character)

    vector with the name of the variables that we want to include in the model. They have to be factor variables with the subgroups as levels. The subgr variables have to be included here.

  • data: (data frame)

    the data frame with the variables.

  • resptype: (string)

    the type of data used. Can be "survival" or "binary".

  • alpha: (scalar)

    the elastic net mixing parameter with values between 0 and 1. The special case of alpha=1 corresponds to a lasso penalty and the case of alpha=0 to a ridge penalty.

  • status: (string)

    only for "survival" resptype, the status variable name in survival data.

Returns

List with fit, model, resptype, data, alpha, design_matrix, design_dummy, y, subgr_names.

Examples

elastic_net( "tt_pfs", "arm", c("x_1", "x_2"), c("x_1", "x_2", "x_3"), example_data, "survival", 1, "ev_pfs" )