# ci.plot

From HH v3.1-8
by Richard Heiberger

##### Plot confidence and prediction intervals for simple linear regression

The data, the least squares line, the confidence interval lines, and the
prediction interval lines for a simple
linear regression (`lm(y ~ x)`

) are displayed. Tick marks are
placed at the location of xbar, the x-value of the narrowest interval.

- Keywords
- hplot, regression

##### Usage

```
ci.plot(lm.object, ...)
## S3 method for class 'lm':
ci.plot(lm.object,
xlim=range(data[, x.name]),
newdata,
conf.level=.95,
data=model.frame(lm.object),
newfit,
ylim,
pch=19,
lty=c(1,3,4,2),
lwd=2,
main.cex=1,
main=list(paste(100*conf.level,
"% confidence and prediction intervals for ",
substitute(lm.object), sep=""), cex=main.cex), ...
)
```

##### Arguments

- lm.object
- Linear model for one
`y`

and one`x`

variable. - xlim
`xlim`

for plot. Default is based on data from which`lm.object`

was constructed.- newdata
`data.frame`

containing data for which predictions are wanted. The variable name of the column must be identical to the name of the predictor variable in the model object. Defaults to a data.frame containing a vector spanni- conf.level
- Confidence level for intervals, defaults to
`.95`

- data
`data`

extracted from the`lm.object`

- newfit
- Constructed
`data.frame`

containing the predictions,confidence interval, and prediction interval for the`newdata`

. - ylim
`ylim`

for plot. Default is based on the constructed prediction interval.- pch
- Plotting character for observed points.
- lty, lwd
- Line types and line width for fit and intervals.
- main.cex
- Font size for main title.
- main
- Main title for plot
- ...
- Additional arguments to be passed to panel function.

##### Value

`"trellis"`

object containing the plot.

##### Note

The `predict.lm`

functions in S-Plus and R differ.
The S-Plus function can produce both confidence and prediction
intervals with a single call. The R function produces only one
of them in a single call. Therefore the default calculation of
`newfit`

within the function depends on the system.

##### See Also

##### Examples

```
tmp <- data.frame(x=rnorm(20), y=rnorm(20))
tmp.lm <- lm(y ~ x, data=tmp)
ci.plot(tmp.lm)
```

*Documentation reproduced from package HH, version 3.1-8, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.