stepCriterion.overglm: Variable selection for alternatives to the Poisson and...

View source: R/overglm3.R

stepCriterion.overglmR Documentation

Variable selection for alternatives to the Poisson and Binomial Regression Models under the presence of Overdispersion

Description

Performs variable selection using hybrid versions of forward stepwise and backward stepwise by comparing hierarchically builded candidate models using a criterion previously specified such as AIC, BIC or p-value of the significance tests.

Usage

## S3 method for class 'overglm'
stepCriterion(
  model,
  criterion = c("bic", "aic", "p-value"),
  test = c("wald", "score", "lr", "gradient"),
  direction = c("forward", "backward"),
  levels = c(0.05, 0.05),
  trace = TRUE,
  scope,
  force.in,
  force.out,
  ...
)

Arguments

model

an object of the class overglm.

criterion

an (optional) character string which allows to specify the criterion which should be used to compare the candidate models. The available options are: AIC ("aic"), BIC ("bic"), and p-value of the test-type test ("p-value"). As default, criterion is set to "bic".

test

an (optional) character string which allows to specify the statistical test which should be used to compare nested models. The available options are: Wald ("wald"), Rao's score ("score"), likelihood-ratio ("lr") and gradient ("gradient") tests. As default, test is set to "wald".

direction

an (optional) character string which allows to specify the type of procedure which should be used. The available options are: hybrid backward stepwise ("backward") and hybrid forward stepwise ("forward"). As default, direction is set to "forward".

levels

an (optional) two-dimensional vector of values in the interval (0,1) indicating the levels at which the variables should in and out from the model. This is only appropiate if criterion="p-value". By default, levels is set to c(0.05,0.05).

trace

an (optional) logical switch indicating if should the stepwise reports be printed. By default, trace is set to TRUE.

scope

an (optional) list, containing components lower and upper, both formula-type objects, indicating the range of models which should be examined in the stepwise search. As default, lower is a model with no predictors and upper is the linear predictor of the model in model.

force.in

an (optional) formula-type object indicating the effects that should be in all models

force.out

an (optional) formula-type object indicating the effects that should be in no models

...

further arguments passed to or from other methods. For example, k, that is, the magnitude of the penalty in the AIC, which by default is set to 2.

Value

A list which contains the following objects:

initial a character string indicating the linear predictor of the "initial model",
direction a character string indicating the type of procedure which was used,
criterion a character string indicating the criterion used to compare the candidate models,
final a character string indicating the linear predictor of the "final model",
final.fit an object of class overglm with the results of the fit to the data of the "final model",

References

James G., Witten D., Hastie T., Tibshirani R. (2013, page 210) An Introduction to Statistical Learning with Applications in R. Springer, New York.

See Also

stepCriterion.lm, stepCriterion.glm, stepCriterion.glmgee

Examples

###### Example 1: Self diagnozed ear infections in swimmers
data(swimmers)
fit1 <- overglm(infections ~ age + gender + frequency + location, family="nb1(log)", data=swimmers)

stepCriterion(fit1, criterion="p-value", direction="forward", test="lr")

stepCriterion(fit1, criterion="bic", direction="backward", test="score", force.in=~location)

###### Example 2: Article production by graduate students in biochemistry PhD programs
bioChemists <- pscl::bioChemists
fit2 <- overglm(art ~ fem + mar + kid5 + phd + ment, family="nb1(log)", data = bioChemists)

stepCriterion(fit2, criterion="p-value", direction="forward", test="lr")

stepCriterion(fit2, criterion="bic", direction="backward", test="score", force.in=~fem)

###### Example 3: Agents to stimulate cellular differentiation
data(cellular)
fit3 <- overglm(cbind(cells,200-cells) ~ tnf + ifn + tnf*ifn, family="bb(logit)", data=cellular)

stepCriterion(fit3, criterion="p-value", direction="backward", test="lr")

stepCriterion(fit3, criterion="bic", direction="forward", test="score")


glmtoolbox documentation built on Sept. 11, 2024, 7:32 p.m.