gamlassoChecks: Checking data before fitting gamlasso

Description Usage Arguments Value Note Examples

View source: R/check.R

Description

This function checks if the arguments entered for fitting a gamlasso model are compatible with each other. Not recommended to call directly. Only use if cleaning data prior to fitting gamlassoFit

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
gamlassoChecks(
  data,
  response.name,
  linear.name,
  smooth.name,
  family,
  linear.penalty,
  smooth.penalty,
  offset.name,
  weights.name,
  num.knots,
  num.iter,
  tolerance,
  seed,
  prompts
)

Arguments

data

The training data for fitting the model

response.name

The name of the response variable. Vector of two if family = "binomial"

linear.name

The names of the variables to be used as linear predictors

smooth.name

The names of the variables to be used as smoothers

family

The family describing the error distribution and link function to be used in the model. A character string which can only be "gaussian" (default), "binomial", "poisson" or "cox". For family = "binomial", response can be a vector of two and for family="cox", weights must be provided (see details below).

linear.penalty

The penalty used on the linear predictors. Can be 0, 1 or 2

smooth.penalty

The penalty used on the smoothers. Can be 1 or 2

offset.name

The name of the offset variable. NULL (default) if not provided

weights.name

The name of the weights variable. NULL (default) if not provided. See Details of gamlasso.

num.knots

Number of knots for each smoothers. Can be a single integer (recycled for each smoother variable) or a vector of integers the same length as the number of smoothers.

num.iter

Number of iterations for the gamlasso loop

tolerance

Tolerance for covergence of the gamlasso loop

seed

The random seed can be specified for reproducibility. This is used for fitting the gam and lasso models, or fixed before each loop of gamlasso.

prompts

logical. Should gamlassoChecks provide interactive user prompts for corrective action when needed.

Value

gamlassoChecks produces a series of logical values: allcheck indicating if the arguments passed all the checks, fit.smoothgam indicating if there aren't any linear predictors and a model with only smoothers should be fitted, fit.glmnet is the counterpart for smooth predictors. It also returns the cleaned (if needed) arguments as a list named cleandata who's elements are:

train.data The training data with unnecessary columns deleted
linear.name, smooth.name, num.knots The changed variable names and number of knots
linear.penalty, smooth.penalty The changed penalties for linear and smooth terms. Reset to their default values only in the rare case of too few predictors

Note

The arguments offset.name, num.iter, tolerance and seed are not currently not being used in testing.

Examples

1
## Usage similar to gamlassoFit

plsmselect documentation built on Dec. 1, 2019, 1:11 a.m.