Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ellipse.lm

Outline a pairwise confidence region for a linear model fit.


Description

This function produces the ellipsoidal outline of a pairwise confidence region for a linear model fit.

Usage

## S3 method for class 'lm'
ellipse(x, which = c(1, 2), level = 0.95, 
    t = sqrt(2 * qf(level, 2, x$df.residual)), ...)

Arguments

x

The first argument should be an lm object, usually resulting from a call to lm().

which

Which selects the pair of parameters to be plotted. The default is the first two.

level

The confidence level of the region. Default 95%.

t

The t statistic on the boundary of the ellipse.

...

Other ellipse.default parameters may also be used.

Details

The summary function is used to obtain the covariance matrix of the fitted parameters.

Value

A matrix with columns x and y to outline the confidence region.

See Also

Examples

# Plot the estimate and joint 90% confidence region for the displacement and cylinder
# count linear coefficients in the mtcars dataset
data(mtcars)
fit <- lm(mpg ~ disp + cyl , mtcars)
plot(ellipse(fit, which = c('disp', 'cyl'), level = 0.90), type = 'l')
points(fit$coefficients['disp'], fit$coefficients['cyl'])

ellipse

Functions for Drawing Ellipses and Ellipse-Like Confidence Regions

v0.4.2
GPL (>= 2)
Authors
Duncan Murdoch <murdoch@stats.uwo.ca> and E. D. Chow (porting to R by Jesus M. Frias Celayeta <iosu@bureau.ucc.ie>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.