Learn R Programming

dglars (version 1.0.2)

summary.dglars: Print the summary for a dglars object

Description

Summary method for class 'dglars'.

Usage

## S3 method for class 'dglars':
summary(object, k = c("BIC", "AIC"), complexity = c("df", "gdf"), 
digits = max(3, getOption("digits") - 3), ...)

Arguments

object
fitted dglars object
k
character/numeric argument used to specify the 'weight' of the complexity part in the measure of goodness-of-fit used to select the best model (see below for more details). Default is k = "BIC";
complexity
measure used to define the complexity of a model. If complexity = "df" then the complexity is defined as the number of nonzero coefficients. For logistic regression model it is possible to use the generalized degrees of freedom to measure
digits
significant digits in printout
...
additional print arguments

Value

  • A list with components table and b.gof is silently returned. The table component is the data.frame previously described while the component b.gof is the vector of the estimated coefficients corresponding to the best models identified using the GoF criterion. Alternatively, the user can use the internal function make_summary_table to obtain this list (see the example below).

Details

summary.dglars gives us information about the sequence of models identified by dgLARS method.

To select the best model the summary method uses a measure of goodness-of-fit (GoF) defined as follows: $$Dev + k \times complexity,$$ where $Dev$ is the residual deviance, $complexity$ is the term used to measure the complexity of the fitted model and $k$ is the term used to 'weight' the complexity part in the GoF formula. By default the summary method computed the BIC criterion to select the best model, which means that the argument complexity is equal "df" (the number of nonzero coefficients) and the argument k is equal to "BIC". The AIC criterion can be easily computed setting k = "AIC" and complexity = "df". The user can define other measures of goodness-of-fit, specifying k as any non-negative integer and, for example, using the generalized degrees-of- freedom to measure the complexity of the fitted model (see the gdf function for more details).

The output of the summary method is divided in two sections. The first section shows the call that produced the object x followed by a data.frame. The column named Sequence gives us information on how is changed the active set along the path. The column named g shows the sequence of the $\gamma$ values used to compute the solution curve, while the column Dev shows the corresponding residual deviance. The remaining columns show the complexity measure, the used measure of goodness-of-fit and the corresponding ranking of the models. Finally, the second section show the estimated coefficients of the best models identified by the used GoF criterion. Like for the print.dglars method, information about the method, the algorithm and the corresponding convergence are also provided.

See Also

dglars and gdf functions.

Examples

Run this code
###########################
# Logistic regression model

set.seed(123)

n <- 100
p <- 10
X <- matrix(rnorm(n*p), n, p)
b <- 1:2
eta <- b[1] + X[,1] * b[2]
mu <- binomial()$linkinv(eta)
y <- rbinom(n, 1, mu)
fit <- dglars.fit(X, y, family = "binomial")

## the BIC criterion is used to select the best model
summary(fit, k= "BIC",complexity = "df")
## the AIC criterion is used to select the best model
summary(fit, k= "AIC",complexity = "df")

tbl <- make_summary_table(fit, k=log(n), complexity = "df")
str(tbl)
summary(fit, complexity = "gdf")
tbl <- make_summary_table(fit, k=log(n), complexity = "gdf")
str(tbl)

##########################
# Poisson regression model

n <- 100
p <- 10
X <- matrix(rnorm(n*p), n, p)
b <- 1:2
eta <- b[1] + X[,1] * b[2]
mu <- poisson()$linkinv(eta)
y <- rpois(n, mu)
fit <- dglars.fit(X, y, family = "poisson")

## the BIC criterion is used to select the best model
summary(fit, k= "BIC",complexity = "df")
## the AIC criterion is used to select the best model
summary(fit, k= "AIC",complexity = "df")

tbl <- make_summary_table(fit, k=log(n), complexity = "df")
str(tbl)
summary(fit, k=log(n), complexity = "gdf")

Run the code above in your browser using DataLab