Learn R Programming

hdme (version 0.6.0)

plot.gds: Plot the estimates returned by gds

Description

Plot the number of nonzero coefficients at the given lambda.

Usage

# S3 method for gds
plot(x, ...)

Arguments

x

An object of class gds

...

Other arguments to plot (not used).

Examples

Run this code
set.seed(1)
# Example with logistic regression
# Number of samples
n <- 1000
# Number of covariates
p <- 10
# True (latent) variables (Design matrix)
X <- matrix(rnorm(n * p), nrow = n)
# True regression coefficients
beta <- c(seq(from = 0.1, to = 1, length.out = 5), rep(0, p-5))
# Binomially distributed response
y <- rbinom(n, 1, (1 + exp(-X %*% beta))^(-1))
# Fit the generalized Dantzig Selector
gds <- gds(X, y, family = "binomial")
# Plot the estimated coefficients at the chosen lambda
plot(gds)

Run the code above in your browser using DataLab