Learn R Programming

dglars (version 1.0.3)

plot.dglars: Plot from a dglars object

Description

Produces different plots to study the sequence of models identified by the dgLARS method.

Usage

## S3 method for class 'dglars':
plot(x, k = c("BIC","AIC"), complexity = c("df","gdf"), 
	g.gof = NULL, ...)

Arguments

x
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
g.gof
a user specified value of the tuning parameter;
...
additional graphical parameters.

Details

plot.dglars method produces different plots to study the sequence of models identified by the dgLARS method.

The first plot show the goodness-of-fit (Gof) criterion $$Dev + k \times complexity,$$ as functions of the used $\gamma$ values. In the GoF formula the $Dev$ component is the residual deviance, $complexity$ is the term used to measure the complexity of the fitted model while $k$ is the term used to 'weight' the complexity part in the GoF formula. By default, plot.dlgars uses the BIC criterion as measure of goodness-of-fit, i.e k = "BIC" and complexity = "df", but the AIC criterion can be easily computed setting k = "AIC" and complexity = "df". See also summary.dglars for more details about the arguments k and complexity. The value of the tuning parameter corresponding to the minimum of the GoF curve is labeled by a vertical dashed red line, while the $\gamma$ values at which corresponds a change in the active set are labeled by vertical dashed gray lines. Next plot shows the coefficient profile plot while, if the control parameter algorithm is equal to "pc", the last plot shows the Rao's score test statistics as functions of $\gamma$. Also in these two plots, the optimal $\gamma$ and the $\gamma$ values at which corresponds a change in the active set are labeled by vertical dashed lines, red and gray respectively.

See Also

dglars and summary.dglars function.

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_pc <- dglars.fit(X, y, family = "binomial")
par(mfrow = c(2, 3))
plot(fit_pc, k = "BIC", complexity = "df")
plot(fit_pc, k = "AIC", complexity = "df")

fit_ccd <- dglars.fit(X, y, family = "binomial", 
control = list(algorithm = "ccd"))
par(mfrow = c(2, 2))
plot(fit_ccd, k = "BIC", complexity = "df")
plot(fit_ccd, k = "AIC", complexity = "df")

Run the code above in your browser using DataLab