plot.sprm: Plots for sprm objects

Description Usage Arguments Details Author(s) References See Also Examples

Description

Four types of plot options are available:

y vs y predicted plot, plot of case weights used for robust weighted regression, plot of estimated coefficients, distance-distance plot.

Usage

1
2
3
4
5
## S3 method for class 'sprm'
plot(x, type = "yyp", alpha = 0.025, colors = list(bars = "#0000AA", 
errorbars = "red", background = "#BBBBEE", abline = "#21A0D2", scores = "#0000AA",
cutoffs = "#00EEEE", badouts="darkred", modouts="black"), textsize = 6, 
errorbar_width = 1, data, yscale = NULL, ...)

Arguments

x

object of class sprm.

type

choices are "yyp", "weights", "coefficients", "dd" (see Details).

alpha

significance level. Default is 0.025. Will be ignored if type="weights".

colors

list with six elements with color codes or names for bar, errorbars, background, abline, scores, cutoffs, badouts (outliers with weight zero) and modouts (moderate outliers).

textsize

the text size in which to print the scores and loading names. Will be ignored if type is "weights" or "coefficients".

errorbar_width

a numeric containing the width of the error bars for type="yyp".

data

optional data frame, containing new cases to predict and plot for type="yyp" and type="dd".

yscale

optional scale vector for the yscale in the y vs y predicted plot (e.g. if two different regression plots have to be on the same scale)

...

further arguments. Currently not used.

Details

The choices for type are:

type="yyp" - y vs y predicted plot with confidence intervals for each observation.

type="weights" - plot of case weights used for robust weighted regression.

type="coefficients" - plot of the value of each coefficient estimate with confidence interval.

type="dd" - distance-distance plot for for visualization of leverage points. Robust distances are plotted against Mahalanobis distances.

Author(s)

Sven Serneels, BASF Corp.

References

Hoffmann, I., Serneels, S., Filzmoser, P., Croux, C. (2015). Sparse partial robust M regression. Chemometrics and Intelligent Laboratory Systems, 149, 50-59.

Serneels, S., Croux, C., Filzmoser, P., Van Espen, P.J. (2005). Partial Robust M-Regression. Chemometrics and Intelligent Laboratory Systems, 79, 55-64.

See Also

sprm, biplot.sprm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(5023)
U1 <- c(rep(2,20), rep(5,30))
U2 <- rep(3.5,50)
X1 <- replicate(5, U1+rnorm(50))
X2 <- replicate(20, U2+rnorm(50))
X <- cbind(X1,X2)
beta <- c(rep(1, 5), rep(0,20))
e <- c(rnorm(45,0,1.5),rnorm(5,-20,1))
y <- X%*%beta + e
d <- as.data.frame(X)
d$y <- y
smod <- sprms(y~., data=d, a=1, eta=0.5, fun="Hampel")
mod <- prms(y~., data=d, a=1, fun="Hampel")

plot(smod, type="yyp", errorbar_width=0.001)

plot(smod, type="coefficients")
plot(mod, type="coefficients")

plot(smod, type="weights")

plot(smod, type="dd", colors=list(background="lightgray", scores="darkblue", cutoffs="red"))

sprm documentation built on May 2, 2019, 9:57 a.m.