Learn R Programming

spareg (version 1.1.1)

spar_glmnet: Penalized GLM Marginal 'sparmodel'

Description

Creates an object class 'sparmodel' using arguments passed by user.

Usage

spar_glmnet(..., control = list())

Value

object of class 'sparmodel' which is a list with elements

  • name (character)

  • control (list of controls passed as an argument)

  • model_fun for generating the screening coefficient. This function should have arguments y, vector of standardized responses, z, a matrix of projected predictors in each marginal model, and object, which is a 'sparmodel' object. Returns a list with two elements: gammas which is the vector of regression coefficients for the projected predictors and intercept which is the intercept of the model.

  • update_fun optional function for updating the 'sparmodel' object before the start of the algorithm.

Arguments

...

includes arguments which can be passed as attributes to the 'sparmodel' object

control

list of controls to be passed to the model function

Details

Relies on glmnet.

Examples

Run this code
example_data <- simulate_spareg_data(n = 100, p = 400, ntest = 100)
spar_res <- spar(example_data$x, example_data$y,
  xval = example_data$xtest, yval = example_data$ytest,
  model = spar_glmnet(alpha = 0.1))

Run the code above in your browser using DataLab