Learn R Programming

DMR (version 2.0)

DMR4glm: Delete or Merge Regressors for Generalized Linear Models

Description

DMR4glm is a backward model selection procedure which simultaneously deletes continuous variables and merges levels of factors. It is a generalization of DMR onto generalized linear models, where instead of squared t-statistics, squared Wald statistics are used. The final model is selected by minimization of generalized information criterion in the nested family of models.

Usage

DMR4glm(model, K = log(nrow(model$model)), clust.method = 'complete')

Arguments

model
initial model of class glm.
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
Models
a list of models of class glm on the nested path searched through
Best
a list containing features of the selected model: Partition, Model of class glm, Crit and Hypotheses represesnted as a matrix of lienear hypotheses imposed on the model's parameters

See Also

DMR, stepDMR, 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)
mi <- rep(c(2 , 2, -1, -1, -1, -1, 0, 0), each = 12*k)
y <- rbinom(96*k, 1, exp(mi)/(1+exp(mi)) )
m <- glm(y ~ x1 + x2 + v1 + v2 + v3, family = binomial)
(out <- DMR4glm(m))

Run the code above in your browser using DataLab