halfnormal | R Documentation |
Generic function and methods for creating half normal effects plots
halfnormal(x, ...)
## Default S3 method:
halfnormal(x, labs=names(x), codes = NULL, pch = 1, cex.text = 1,
alpha = 0.05, xlab = "absolute effects", large.omit = 0, plot=TRUE,
crit=NULL, ...)
## S3 method for class 'lm'
halfnormal(x, labs = NULL, code = FALSE, pch = NULL, cex.text = 1,
alpha = 0.05, xlab = "absolute coefficients", large.omit = 0, plot=TRUE,
keep.colons = !code, ME.partial = FALSE,
external.pe = NULL, external.center = FALSE, contr.center = "contr.poly",
pch.set = c(1, 16, 8), scl = NULL, method="Lenth",
legend=code, err.points=TRUE, err.line=TRUE, linecol="darkgray", linelwd=2,
...)
## S3 method for class 'design'
halfnormal(x, response = NULL, labs = NULL, code = FALSE, pch = NULL,
cex.text = 1,
alpha = 0.05, xlab = "absolute coefficients", large.omit = 0, plot=TRUE,
keep.colons = !code, ME.partial = FALSE,
external.pe = NULL, external.center = FALSE, contr.center = "contr.poly",
pch.set = c(1, 16, 8), scl = NULL, method="Lenth",
legend=code, err.points=TRUE, err.line=TRUE, linecol="darkgray", linelwd=2,
...)
ME.Lenth(b, simulated=TRUE, alpha=NULL)
CME.LW98(b, sterr, dfe, simulated=TRUE, alpha=NULL)
CME.EM08(b, sterr, dfe, simulated=TRUE, weight0=5, alpha=NULL)
x |
a numeric vector of effects, a linear model from experimental data,
or an experimental design of class |
labs |
effect labels; |
codes |
a vector with a code for each effect; the default |
code |
a logical; |
pch |
plot symbol; |
cex.text |
factor to hand to |
alpha |
number between 0 and 1: the significance level for labelling effects; |
xlab |
character string: the x axis label |
plot |
logical; if |
large.omit |
integer number of largest effects to be omitted from plot
and calculations in order to concentrate on the smaller effects;
(note that the significance is also re-assessed; if that is undesirable,
an explicit |
crit |
default |
keep.colons |
if |
ME.partial |
if |
external.pe |
numeric vector with values from outside the experimental data for use in estimating the error variance |
external.center |
if |
contr.center |
contrasts used for external center points;
|
pch.set |
plot symbols used for experimental effects, automatically determined lack of fit contrasts or pure error effects |
scl |
squared column length to which the model matrix is normalized; default: number of experimental runs |
method |
the default |
legend |
squared column length to which the model matrix is normalized; default: number of experimental runs |
err.points |
logical, default |
err.line |
logical, default |
linecol |
specifies the color for the null line, if applicable |
linelwd |
specifies the width of the null line, if applicable |
response |
response for which the plot is to be created |
... |
further options to be handed to the |
b |
vector of coefficients |
simulated |
logical; if |
sterr |
a standard error for |
dfe |
the number of pure error degrees of freedom on which
|
weight0 |
a tuning parameter for the method by Edwards and Mee 2008; Edwards and Mee recommend to set this to 5 |
Function halfnormal
creates half normal effects plots with automatic
effect labelling according to significance. It also prints the significant
effects and creates an output object that contains only the vector if signifcant
effects (for the default method) or in addition several further components (see
section "Value"). Note: The methods for linear models and experimental designs plot
absolute coefficients from a linear model (i.e. in case of 2-level factors with
the usual -1/+1 coding, half of the absolute effects).
The methods for linear models and experimental designs allow to automatically
create lack of fit and pure error contrasts to also be included in the plot,
following an orthogonalization strategy similar to Section 5 in Langsrud (2001).
Furthermore, they handle factors with more than two levels, and they handle partially
aliased effects by orthogonalizing out previous effects from later effects in
the model order (similar to what Langsrud 2001 proposed for multiple response
variables); thus, the plots are order dependent in case of partial aliasing.
The more severe the partial aliasing, the more drastic the difference between the
different effect orders. Per default, main effects are required to be
orthogonal; this can be changed via option ME.partial
.
The functions ME.Lenth
, CME.LW98
and CME.EM08
yield standard
error estimates and critical values. For alpha in 0.01, 0.02, ..., 0.25,
function ME.Lenth
uses simulated critical values from a large number of
simulations (1000000), if the number of effects is in 7 to 143.
Functions CME.LW98
and CME.EM08
currently simulate critical values
from 10000 simulation runs on the fly.
If no simulated values are available or simulation has been switched off,
the half-normal plotting routines will use the conservative t-values proposed by
Lenth (1989) (ME.Lenth
) or Larntz and Whitcomb (CME.LW98
and CME.EM08
).
Vector valued entries for pch
, col
and cex
are handled
very specifically for the class lm
and class design
methods:
They make the most sense if the model is already saturated:
If no pure error effects have been automatically calculated, effects whose pch
is identical to the third element of pch.set
will be treated as pure error effects;
this allows to manually code these effects.
Generally, vector-valued pch
(and col
and cex
) must have as
many elements as the final coefficients vector after augmenting the coefficients;
the coefficient vector carries first the experimental coefficients, then the automatically
calculated lack-of-fit coefficients, then the automatically calculated pure error
coefficients, then lack-of fit coefficients from external replications,
and finally the pure error coefficients from external replications. Even for
err.points=FALSE
, entries for all these elements are needed. The value for
pch
determines, which coefficients are considered pure error.
The default method for halfnormal
visibly returns a character vector of significant
effects only. The methods for linear models and experimental designs invisibly return lists
of nine elements:
coef | contains the estimated coefficients |
mm | contains the model matrix |
after adjustment to equally scaled independent effects | |
mod.effs | the effects that are part of the model |
res | list that indicates the effects (named vector of position numbers) |
that were projected out from any particular model effect (element name) | |
LCs | contains the coefficients of the linear combinations |
taken from the residuals after projecting out the effects | |
listed in res from the original model matrix columns. |
|
Where LCs elements are NULL , |
|
the original effect completely disappeared | |
because of complete confounding with previous effects. | |
alpha | contains the significance level |
method | contains the method of significance assessment |
signif | is a character vector of significant effects |
pchs | is a numeric vector of plot character identifiers |
The functions ME.Lenth
, CME.LW98
and CME.EM08
each
return lists of length 4 with an estimate for s0, PSE, ME and SME for Lenth's
method or their respective modifications for the other two methods (called
s0, CPSE, CME and CSME for CME.LW98
and Cs0, CPSE, CME and CSME for
CME.EM08
). The length of the (C)ME and (C)SME components depends on
the length of alpha (default: 25 critical values for alphas from 0.25 to 0.01).
If someone worked out how to modify symbol colors (option col
)
and/or sizes (option cex
) for a version before 0.26-2,
version 0.26-2 will mess up the order of the symbol colors and/or sizes.
The benefit: colors and symbol sizes can now be specified in the natural
order, see description of the ... argument.
Ulrike Groemping, Berliner Hochschule fuer Technik
Daniel, C. (1959) Use of Half Normal Plots in Interpreting Two Level Experiments. Technometrics 1, 311–340.
Daniel, C. (1976) Application of Statistics to Industrial Experimentation. New York: Wiley.
Edwards, D. and Mee, R. (2008) Empirically Determined p-Values for Lenth t Statistics. Journal of Quality Technology 40, 368–380.
Langsrud, O. (2001) Identifying Significant Effects in Fractional Factorial Multiresponse Experiments. Technometrics 43, 415–424.
Larntz, K. and Whitcomb, P. (1998) Use of replication in almost unreplicated factorials. Manuscript of a presentation given at the 42nd ASQ Fall Technical conference in Corning, New York. Downloaded 4/26/2013 at https://cdnm.statease.com/pubs/use-of-rep.pdf.
Lenth, R.V. (1989) Quick and easy analysis of unreplicated factorials. Technometrics 31, 469–473.
See also DanielPlot
for (half) normal plots
of 2-level fractional factorial designs without partial aliasing
and ignoring any residual degrees of freedom
### critical values
b <- rnorm(12)
ME.Lenth(b)
ME.Lenth(b)$ME
ME.Lenth(b, alpha=0.22)
ME.Lenth(b, alpha=0.123)
ME.Lenth(b, alpha=0.12)
ME.Lenth(rnorm(144), alpha=0.1)
(mel <- ME.Lenth(b, alpha=0.1))
## assuming an external effect standard error based on 3df
## Not run: CME.EM08(b, 0.1, 3, alpha=0.1)
## does not run for saving CRAN check time
## much smaller than Lenth, if external
## standard error much smaller than s0 (see mel)
### Half normal plots
## the default method
halfnormal(rnorm(15), labs=paste("b",1:15,sep=""))
b <- c(250, 8,7,6, rnorm(11))
halfnormal(b, labs=paste("b",1:15,sep=""))
halfnormal(b, labs=paste("b",1:15,sep=""), large.omit=1)
## the design method, saturated main effects design
plan <- oa.design(L12.2.11)
halfnormal(add.response(plan,rnorm(12)))
## the design method, saturated main effects design,
## partial aliasing due to a missing value
y <- c(NA, rnorm(11))
## the following line would yield an error, because there is even
## complete aliasing among main effects:
## Not run: halfnormal(lm(y~., add.response(plan, y)), ME.partial=TRUE)
## this can only be helped by omitting a main effect from the model;
## afterwards, there is still partial aliasing,
## which must be explicitly permitted by the ME.partial option:
halfnormal(lm(y~.-D, add.response(plan, y)), ME.partial=TRUE)
## the linear model method
yc <- rnorm(12)
## partial aliasing only
halfnormal(lm(yc~A+B+C+D+E+F+G+H+J+A:B, plan))
## both partial (A:B) and complete (E:F) aliasing are present
halfnormal(lm(yc~A+B+C+D+E+F+G+H+J+A:B+E:F, plan))
## complete aliasing only because of the missing value in the response
halfnormal(lm(y~A+B+C+D+E+F+G+H+J+A:B+E:F, plan),ME.partial=TRUE)
## omit a large dominating effect
halfnormal(lm(y~A+B+C+D+E+F+G+H+J+A:B+E:F, plan),ME.partial=TRUE)
## a regular fractional factorial design with center points
y20 <- rnorm(20)
## Not run: halfnormal(lm(y20~.^2, FrF2(16,7,ncenter=4)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.