Learn R Programming

R330 (version 1.0)

boxcoxplot: Draws a Box-Cox plot

Description

Draws a plot of the Box-Cox profile likelihood.

Usage

boxcoxplot(f, p = seq(-2, 2, length = 20), ...) "boxcoxplot"(f, p = seq(-2, 2, length = 20), ...) "boxcoxplot"(f, p = seq(-2, 2, length = 20), data, subset, weights, na.action, method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, contrasts = NULL, offset, ...)

Arguments

f
an lm object or a model formula
p
a vector of powers, representing plotting positions along the horizontal axis
data
A data frame, list or environment containing the variables in the model.
subset
an optional vector specifying a subset of observations to be used in the fitting process.
weights
an optional vector of `prior weights' to be used in the fitting process. Should be NULL or a numeric vector.
na.action
a function which indicates what should happen when the data contain NAs. The default is set by the na.action setting of options, and is na.fail if that is unset. The `factory-fresh' default is na.omit. Another possible value is NULL, no action. Value na.exclude can be useful.
method
the method to be used in fitting the model. The default method "glm.fit" uses iteratively reweighted least squares (IWLS): the alternative "model.frame" returns the model frame and does no fitting.
x, y, qr, model
For glm: logical values indicating whether the response vector and model matrix used in the fitting process should be returned as components of the returned value.

For glm.fit: x is a design matrix of dimension n * p, and y is a vector of observations of length n.

singular.ok
logical. If FALSE (the default in S but not in R) a singular fit is an error.
contrasts
an optional list. See the contrasts.arg of model.matrix.default.
offset
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector of length equal to the number of cases. One or more offset terms can be included in the formula instead or as well, and if more than one is specified their sum is used. See model.offset.
...
graphical arguments passed to plot function

Value

Returns no value but draws a plot of the Box-Cox profile likelihood.

Details

The function draws a graph of the negative of the profile likelihood as a function of the transformation power p. The regression coeficients and the standard deiatoin of the eroors have been profiled out. The indicated power is the value of p for which the function attains ist minimum. It may on rare occasions be necessary to adjust the range of p (default is (2,2)).

References

Box, GEP and Cox, DR. (1964). An analysis of transformations. Journal of the Royal Statistical Society, Series B 26 (2): pp 211-252

Examples

Run this code
data(educ.df)
boxcoxplot(educ~urban + percap + under18, data=educ.df[-50,])

data(wine.df)
boxcoxplot(price~year+temp+h.rain+w.rain,data=wine.df)

Run the code above in your browser using DataLab