Skip to contents

Helper function to help set up penalties

Usage

get_penalties(
  varnames,
  poly,
  poly_prefix = "poly_",
  int_sep = "\\:",
  pool = FALSE,
  gamma = 0.5,
  cumulative_k = FALSE,
  cumulative_poly = TRUE
)

Arguments

varnames

names of the covariates in the model matrix

poly

max polynomial considered

poly_prefix

what comes before the polynomial specification in these varnames?

int_sep

What denotes the multiplication for interactions?

pool

Should polynomials and interactions be pooled?

gamma

How much should the penalty increase with group size (0.5 assumes equal contribution of prior information)

cumulative_k

Should penalties be increased cumulatively as order interaction increases? (only used if !pool)

cumulative_poly

Should penalties be increased cumulatively as order polynomial increases? (only used if !pool)

Value

a list of relevant information for the variables, including:

penalties

the numeric value of the penalties

vartype

Variable type (main effect, order k interaction, etc)

varname

names of variables

Details

This is primarily a helper function for sparseR, but it may be useful if doing the model matrix set up by hand.