stepCriterion.overglm {glmtoolbox} | R 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 |
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, |
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, |
levels |
an (optional) two-dimensional vector of values in the interval |
trace |
an (optional) logical switch indicating if should the stepwise reports be printed. By default,
|
scope |
an (optional) list, containing components |
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, |
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")