Learn R Programming

DMR (version 2.0)

stepDMR: Stepwise Delete or Merge Regressors

Description

Stepwise DMR is a backward model selection procedure which simultaneously deletes continuous variables and merges levels of factors. It is a stepwise version of DMR, where in every step the values of squared t-statistics are recalculated. The final model is selected by minimization of generalized information criterion in the nested family of models.

Usage

stepDMR(model, K = log(nrow(model$model)))

Arguments

model
initial model of class lm.
K
penalty for the number of parameters in generalized information criterion, default is log(n).

Value

a list including elements
Partitions
a list of partitions of factors for the models on the nested path searched through
Crit
values of generalized information criterion for the models on the nested path searched through
LogLik
values of log-likelihood for the models on the nested path searched through
Best
a list containing features of the selected model: Partition, Model of class lm, Crit and Hypotheses represesnted as a matrix of lienear hypotheses imposed on the model's parameters

See Also

DMR, DMR4glm, plot_bf, roc

Examples

Run this code
k=4
v1 <- factor(rep(1:8, each = 12*k))
v2 <- factor(rep(1:4, times = 24*k))
v3 <- factor(rep(1:3, times = 32*k))
x1 <- rnorm(96*k)
x2 <- runif(96*k)
y <- rep(c(2, 2, -1, -1, -1, -1, 0, 0), each = 12*k) + rnorm(96*k)
m <- lm(y ~ v1 + v2 + v3 + x1 + x2)
(out <- stepDMR(m))

Run the code above in your browser using DataLab