Plots for prm objects

Share:

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 'prm'
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 prm.

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 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

prms, biplot.prm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(5023)
U <- c(rep(2,20), rep(5,30))
X <- replicate(6, U+rnorm(50))
beta <- c(rep(1, 3), rep(-1,3))
e <- c(rnorm(45,0,1.5),rnorm(5,-20,1))
y <- X%*%beta + e
d <- as.data.frame(X)
d$y <- y
mod <- prms(y~., data=d, a=2, fun="Hampel")

plot.prm(mod, type="yyp", errorbar_width=0.001)
plot(mod, type="coefficients", 
colors = list(bars = "darkgreen", errorbars = "red", background = "lightgray"))
plot(mod, type="weights")