plot.enetLTS

0th

Percentile

plots from the "enetLTS" object

Produce plots for the coefficients, residuals, and diagnostics of the current model.

Keywords
regression, classification
Usage
# S3 method for enetLTS
plot(x,method=c("coefficients","resid","diagnostic"),
       vers=c("reweighted","raw"),...)
Arguments
x

object of class enetLTS, the model fit to be plotted.

method

a character string specifying the type of plot. Possible values are "coefficients" to plot the coefficients via plotCoef.enetLTS, "resid" to plot the residuals via plotResid.enetLTS, or "diagnostic" for diagnostic plot via plotDiagnostic.enetLTS.

vers

a character string denoting which model to use for the plots. Possible values are "reweighted" (the default) for plots from the reweighted fit, and "raw" for plots from the raw fit.

additional arguments from the enetLTS object if needed.

Value

An object of class "ggplot" (see ggplot).

Note

For method, the choices are:

method="coefficients" - coefficients vs indices.

method="resid" - residuals vs indices. (for both family="binomial" and family="gaussian").

- additionally, residuals vs fitted values (for only family="gaussian").

method="diagnostics" - fitted values vs indices.

References

Kurnaz, F.S., Hoffmann, I. and Filzmoser, P. (2017) Robust and sparse estimation methods for high dimensional linear and logistic regression. Chemometrics and Intelligent Laboratory Systems.

See Also

ggplot, enetLTS, coef.enetLTS, predict.enetLTS, residuals.enetLTS, fitted.enetLTS

Aliases
  • plot.enetLTS
Examples
# NOT RUN {
## for gaussian

set.seed(86)
n <- 100; p <- 25                             # number of observations and variables
beta <- rep(0,p); beta[1:6] <- 1              # 10% nonzero coefficients
sigma <- 0.5                                  # controls signal-to-noise ratio
x <- matrix(rnorm(n*p, sigma),nrow=n)
e <- rnorm(n,0,1)                             # error terms
eps <- 0.1                                    # contamination level
m <- ceiling(eps*n)                           # observations to be contaminated
eout <- e; eout[1:m] <- eout[1:m] + 10        # vertical outliers
yout <- c(x %*% beta + sigma * eout)          # response
xout <- x; xout[1:m,] <- xout[1:m,] + 10      # bad leverage points

# }
# NOT RUN {
fit1 <- enetLTS(xout,yout,alphas=0.5,lambdas=0.05,plot=FALSE)
plot(fit1)
plot(fit1,method="resid",vers="raw")
plot(fit1,method="coefficients",vers="reweighted")
plot(fit1,method="diagnostic")
# }
# NOT RUN {
## for binomial
eps <-0.05                                     # %10 contamination to only class 0
m <- ceiling(eps*n)
y <- sample(0:1,n,replace=TRUE)
xout <- x
xout[y==0,][1:m,] <- xout[1:m,] + 10;          # class 0
yout <- y                                      # wrong classification for vertical outliers

# }
# NOT RUN {
fit2 <- enetLTS(xout,yout,family="binomial",alphas=0.5,lambdas=0.05,plot=FALSE)
plot(fit2)
plot(fit2,method="resid",vers="raw")
plot(fit2,method="coefficients",vers="reweighted")
plot(fit2,method="diagnostic")
# }
Documentation reproduced from package enetLTS, version 0.1.0, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.