Learn R Programming

asbio (version 0.2-1)

plotCI.reg: Plots a simple linear regression along with confidence and prediction intervals.

Description

Plots the fitted line from a simple linear regression (y ~ x) and (if requested) confidence and prediction intervals.

Usage

plotCI.reg(x, y, conf = 0.95, CI = TRUE, PI = TRUE, reg.col = 1, CI.col = 2, 
PI.col = 4, reg.lty = 1, CI.lty = 2, PI.lty = 3, reg.lwd = 1, CI.lwd = 1, ...)

Arguments

x
The explanatory variable, a numeric vector.
y
The response variable, a numeric vector
conf
The level of confidence; 1 - P(type I error)
CI
Logical; should the confidence interval be plotted?
PI
Logical; should the prediction interval be plotted?
reg.col
Color of the fitted regression line.
CI.col
Color of the confidence interval lines.
PI.col
Color of the prediction interval lines.
reg.lty
Line type for the fitted regression line.
CI.lty
Line type for the confidence interval.
PI.lty
Line type for the confidence interval.
reg.lwd
Line width for the regression line.
CI.lwd
Line widths for the connfidence and prediction intervals.
...
Additional arguments from plot

Value

  • Returns a plot with a regression line and (if requested) confidence and prediction intervals

See Also

plot, predict

Examples

Run this code
y<-c(1,2,1,3,4,2,3,4,3,5,6)
x<-c(2,3,1,4,5,4,5,6,7,6,8)
plotCI.reg(x,y)

Run the code above in your browser using DataLab