LenthPlot: Lenth's Plot of Effects

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

View source: R/LenthPlot.R

Description

Plot of the factor effects with significance levels based on robust estimation of contrast standard errors.

Usage

1
2
3
LenthPlot(obj, alpha = 0.05, plt = TRUE, limits = TRUE,
    xlab = "factors", ylab = "effects", faclab = NULL, cex.fac = par("cex.lab"),
    cex.axis=par("cex.axis"), adj = 1, ...)

Arguments

obj

object of class lm or vector with the factor effects.

alpha

numeric. Significance level used for the margin of error (ME) and simultaneous margin of error (SME). See Lenth(1989).

plt

logical. If TRUE, a spikes plot with the factor effects is displayed. Otherwise, no plot is produced.

limits

logical. If TRUE ME and SME limits are displayed and labeled.

xlab

character string. Used to label the x-axis. "factors" as default.

ylab

character string. Used to label the y-axis. "effects" as default.

faclab

list with components idx (numeric vector) and lab (character vector). The idx entries of effects vector (taken from obj) are labelled as lab. The rest of the effect names are blanked. If NULL all factors are labelled using the coefficients' name.

cex.fac

numeric. Character size used for the factor labels.

cex.axis

numeric. Character size used for the axis.

adj

numeric between 0 and 1. Determines where to place the "ME" (margin of error) and the "SME" (simultaneous margin of error) labels (character size of 0.9*cex.axis). 0 for extreme left hand side, 1 for extreme right hand side.

...

extra parameters passed to plot.

Details

If obj is of class lm, 2*coef(obj) is used as factor effect with the intercept term removed. Otherwise, obj should be a vector with the factor effects. Robust estimate of the contrasts standard error is used to calculate marginal (ME) and simultaneous margin of error (SME) for the provided significance (1 - alpha) level. See Lenth(1989). Spikes are used to display the factor effects. If faclab is NULL, factors are labelled with the effects or coefficient names. Otherwise, those faclab\$idx factors are labelled as faclab\$lab. The rest of the factors are blanked.

Value

The function is called mainly for its side effect. It returns a vector with the value of alpha used, the estimated PSE, ME and SME.

Author(s)

Ernesto Barrios. Extension provided by Kjetil Kjernsmo (2013).

References

Lenth, R. V. (1989). "Quick and Easy Analysis of Unreplicated Factorials". Technometrics Vol. 31, No. 4. pp. 469–473.

See Also

DanielPlot, BsProb and plot.BsProb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
### Tensile Strength Experiment. Taguchi and Wu. 1980
library(BsMD)
# Data
data(BM86.data,package="BsMD")     # Design matrix and responses
print(BM86.data)    # from Box and Meyer (1986)

# Model Fitting. Box and Meyer (1986) example 2.
tensileStrength.lm <- lm(y2 ~ X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 +
                    X10 + X11 + X12 + X13 + X14 + X15, data = BM86.data)
print(coef(tensileStrength.lm)) # Model coefficients

par(mfrow=c(1,2),pty="s")
DanielPlot(tensileStrength.lm, main = "Daniel Plot")
LenthPlot(tensileStrength.lm, main = "Lenth's Plot")

Example output

   X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15   y1   y2   y3   y4
1  -1 -1  1 -1  1  1 -1 -1  1   1  -1   1  -1  -1   1 0.23 43.7 14.0 0.08
2   1 -1 -1 -1 -1  1  1 -1 -1   1   1   1   1  -1  -1 0.30 40.2 16.8 0.04
3  -1  1 -1 -1  1 -1  1 -1  1  -1   1   1  -1   1  -1 0.52 42.4 15.0 0.53
4   1  1  1 -1 -1 -1 -1 -1 -1  -1  -1   1   1   1   1 0.54 44.7 15.4 0.43
5  -1 -1  1  1 -1 -1  1 -1  1   1  -1  -1   1   1  -1 0.70 42.4 27.6 0.31
6   1 -1 -1  1  1 -1 -1 -1 -1   1   1  -1  -1   1   1 0.76 45.9 24.0 0.09
7  -1  1 -1  1 -1  1 -1 -1  1  -1   1  -1   1  -1   1 1.00 42.2 27.4 0.12
8   1  1  1  1  1  1  1 -1 -1  -1  -1  -1  -1  -1  -1 0.96 40.6 22.6 0.36
9  -1 -1  1 -1  1  1 -1  1 -1  -1   1  -1   1   1  -1 0.32 42.4 22.3 0.79
10  1 -1 -1 -1 -1  1  1  1  1  -1  -1  -1  -1   1   1 0.39 45.5 17.1 0.68
11 -1  1 -1 -1  1 -1  1  1 -1   1  -1  -1   1  -1   1 0.61 43.6 21.5 0.73
12  1  1  1 -1 -1 -1 -1  1  1   1   1  -1  -1  -1  -1 0.66 40.6 17.5 0.08
13 -1 -1  1  1 -1 -1  1  1 -1  -1   1   1  -1  -1   1 0.89 44.0 15.9 0.77
14  1 -1 -1  1  1 -1 -1  1  1  -1  -1   1   1  -1  -1 0.97 40.2 21.9 0.38
15 -1  1 -1  1 -1  1 -1  1 -1   1  -1   1  -1   1  -1 1.07 42.5 16.7 0.49
16  1  1  1  1  1  1  1  1  1   1   1   1   1   1   1 1.21 46.5 20.3 0.23
(Intercept)          X1          X2          X3          X4          X5 
    42.9625      0.0625     -0.0750      0.1500      0.0750      0.2000 
         X6          X7          X8          X9         X10         X11 
    -0.0125      0.1875      0.2000     -0.0250      0.2125      0.0625 
        X12         X13         X14         X15 
     0.0625     -0.1875      1.0750      1.5500 
    alpha       PSE        ME       SME 
0.0500000 0.2250000 0.5783809 1.1741965 

BsMD documentation built on Feb. 1, 2018, 9:01 a.m.