Learn R Programming

DMR (version 2.0)

DMR: Delete or Merge Regressors

Description

DMR is a stepwise backward model selection procedure which simultaneously deletes continuous variables and merges levels of factors. It is based on ranking linear hypotheses with squared t-statistics, using hierarchical clustering for each categorical variable. The final model is selected by minimization of generalized information criterion in the nested family of models.

Usage

DMR(model, K = log(nrow(model$model)), clust.method = "complete")

Arguments

model
initial model of class lm.
K
penalty for the number of parameters in generalized information criterion, default is log(n).
clust.method
method of clustering the same as in hclust.

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

stepDMR, 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 <- DMR(m))

Run the code above in your browser using DataLab