DMRnet {DMRnet}R Documentation

Delete or Merge Regressors net

Description

Fits a path of linear (family="gaussian") or logistic (family="binomial") regression models, where models are subsets of continuous predictors and partitions of levels of factors in X. Works even if p>=n (the number of observations is greater than the number of columns in the model matrix).

Usage

DMRnet(
  X,
  y,
  family = "gaussian",
  o = 5,
  nlambda = 100,
  lam = 10^(-7),
  interc = TRUE,
  maxp = ifelse(family == "gaussian", ceiling(length(y)/2), ceiling(length(y)/4)),
  lambda = NULL,
  algorithm = "DMRnet",
  clust.method = ifelse(algorithm == "glamer", "single", "complete")
)

Arguments

X

Input data frame; each row is an observation vector; each column can be numerical or integer for a continuous predictor or a factor for a categorical predictor.

y

Response variable; Numerical for family="gaussian" or a factor with two levels for family="binomial". For family="binomial" the last level in alphabetical order is the target class.

family

Response type; one of: "gaussian", "binomial".

o

Parameter of the group lasso screening step, described in Details, the default value is 5.

nlambda

Parameter of the group lasso screening step, described in Details, the default value is 100.

lam

The amount of penalization in ridge regression (used for logistic regression in order to allow for parameter estimation in linearly separable setups) or the amount of matrix regularization in case of linear regression. Used only for numerical reasons. The default is 1e-7.

interc

Should intercept(s) be fitted (the default, interc=TRUE) or set to zero (interc=FALSE). If in X there are any categorical variables, interc=TRUE must be set.

maxp

Maximal number of parameters of the model, smaller values result in quicker computation

lambda

Explicitly provided net of lambda values for the group lasso screening step, described in Details. If provided, it overrides the value of nlambda parameter.

algorithm

The algorithm to be used; for partition selection (merging levels) use one of: "DMRnet" (the default), "glamer" or "PDMR". Alternatively, use "var_sel" for variable (group) selection with no partition selection.

clust.method

Clustering method used for partitioning levels of factors; see function hclust in package stats for details. clust.method="complete" is the default for all algorithms except algorithm="glamer", for which clust.method="single" is the default.

Details

DMRnet algorithm is a generalization of DMR to high-dimensional data. It uses a screening step in order to decrease the problem to p<n and then uses DMR subsequently. The screening is done with the group lasso algorithm implemented in the grpreg package.

First, the group lasso for the problem is solved for nlambda values of lambda parameter, or for the net of lambda values (if lambda is explicitly provided). Next, for each value of lambda, the scaled nonzero second norms of the groups' coefficients are sorted in decreasing order. Finally, the first i over o fraction of the groups with the largest nonzero values are chosen for further analysis, i = 1,2,...,o-1. E.g., if o=5, first 1/5, first 2/5,..., 4/5 groups with the largest scaled nonzero second norm of coefficients are chosen.

The final path of models is chosen by minimizing the likelihood of the models for the number of parameters df equal to 1,...,l<=maxp for some integer l. Note that, in contrast to DMR, the models on the path need not to be nested.

Value

An object with S3 class "DMR", which is a list with the ingredients:

beta

Matrix p times l of estimated parameters; each column corresponds to a model on the nested path having from l to 1 parameter (denoted as df).

df

Vector of degrees of freedom; from l to 1.

rss/loglik

Measure of fit for the nested models: rss (residual sum of squares) is returned for family="gaussian" and loglik (loglikelihood) is returned for family="binomial".

n

Number of observations.

levels.listed

Minimal set of levels of respective factors present in data.

lambda

The net of lambda values used in the screening step.

arguments

List of the chosen arguments from the function call.

interc

If the intercept was fitted: value of parameter interc is returned.

See Also

print.DMR for printing, plot.DMR for plotting, coef.DMR for extracting coefficients and predict.DMR for prediction.

Examples

## DMRnet for linear regression
data(miete)
ytr <- miete[1:200,1]
Xtr <- miete[1:200,-1]
Xte <- miete[201:250,-1]
m1 <- DMRnet(Xtr, ytr)
print(m1)
plot(m1)
g <- gic.DMR(m1, c = 2.5)
plot(g)
coef(m1, df = g$df.min)
ypr <- predict(m1, newx = Xte, df = g$df.min)

## DMRnet for logistic regression
data(promoter)
ytr <- factor(promoter[1:70,1])
Xtr <- promoter[1:70,-1]
Xte <- promoter[71:106,-1]
m2 <- DMRnet(Xtr, ytr, family = "binomial")
print(m2)
plot(m2)
g <- gic.DMR(m2, c = 2)
plot(g)
coef(m2, df = g$df.min)
ypr <- predict(m2, newx = Xte, df = g$df.min)

## PDMR for linear regression
data(miete)
ytr <- miete[1:200,1]
Xtr <- miete[1:200,-1]
Xte <- miete[201:250,-1]
m1 <- DMRnet(Xtr, ytr, algorithm="PDMR")
print(m1)
plot(m1)
g <- gic.DMR(m1, c = 2.5)
plot(g)
coef(m1, df = g$df.min)
ypr <- predict(m1, newx = Xte, df = g$df.min)


[Package DMRnet version 0.4.0 Index]