bw_single {psfmi}R Documentation

Predictor selection function for backward selection of Linear and Logistic regression models.

Description

bw_single Backward selection of Linear and Logistic regression models using as selection method the likelihood-ratio Chi-square value.

Usage

bw_single(
  data,
  formula = NULL,
  Outcome = NULL,
  predictors = NULL,
  p.crit = 1,
  cat.predictors = NULL,
  spline.predictors = NULL,
  int.predictors = NULL,
  keep.predictors = NULL,
  nknots = NULL,
  model_type = "binomial"
)

Arguments

data

A data frame.

formula

A formula object to specify the model as normally used by glm. See under "Details" and "Examples" how these can be specified.

Outcome

Character vector containing the name of the outcome variable.

predictors

Character vector with the names of the predictor variables. At least one predictor variable has to be defined. Give predictors unique names and do not use predictor name combinations with numbers as, age2, gnder10, etc.

p.crit

A numerical scalar. P-value selection criterium. A value of 1 provides the pooled model without selection.

cat.predictors

A single string or a vector of strings to define the categorical variables. Default is NULL categorical predictors.

spline.predictors

A single string or a vector of strings to define the (restricted cubic) spline variables. Default is NULL spline predictors. See details.

int.predictors

A single string or a vector of strings with the names of the variables that form an interaction pair, separated by a “:” symbol.

keep.predictors

A single string or a vector of strings including the variables that are forced in the model during predictor selection. All type of variables are allowed.

nknots

A numerical vector that defines the number of knots for each spline predictor separately.

model_type

A character vector. If "binomial" a logistic regression model is used (default) and for "linear" a linear regression model is used.

Details

A typical formula object has the form Outcome ~ terms. Categorical variables has to be defined as Outcome ~ factor(variable), restricted cubic spline variables as Outcome ~ rcs(variable, 3). Interaction terms can be defined as Outcome ~ variable1*variable2 or Outcome ~ variable1 + variable2 + variable1:variable2. All variables in the terms part have to be separated by a "+".

Value

An object of class smods (single models) from which the following objects can be extracted: original dataset as data, final selected model as RR_model_final, model at each selection step RR_model_setp, p-values at final step according to selection method as multiparm_final, and at each step as multiparm_step, formula object at final step as formula_final, and at each step as formula_step and for start model as formula_initial, predictors included at each selection step as predictors_in, predictors excluded at each step as predictors_out, and Outcome, anova_test, p.crit, call, model_type, predictors_final for names of predictors in final selection step and predictors_initial for names of predictors in start model.

Author(s)

Martijn Heymans, 2020

References

http://missingdatasolutions.rbind.io/


[Package psfmi version 1.4.0 Index]