Description Usage Arguments Warning Author(s) References See Also Examples
given two numeric vectors of equal length, plot a scatter plot of the data, the regression line, and a confidence interval for the mean of a new observation or the prediction interval for a single new observation.
1 2 3 |
x |
a numeric vector of length > 3 |
y |
a numeric vector of length > 3 (equal in length to |
x0 |
the x value at which you wish to make a prediction ( |
int |
interval type. |
level |
the confidence level at which you wish to predict. |
relationship |
the type of relationship that the two vectors share. |
show.range |
logical. If |
user.xlim |
the interval of x values the user wishes to display in the plot. If left unspecified, it will be |
user.ylim |
the interval of y values the user wishes to display in the plot. If left unspecified, it will be |
If x0
is outside the domain of x
, ciplot will extrapolate the data and predict a value of yhat
for the given x0
. This may be dangerous, depending on how your data behaves outside the existing domain.
Jonathan Schwartz
Montgomery, D. C., Peck, E. A., Vining, G. G. (2013), Introduction to Linear Regression Analysis, Hoboken, NJ: John Wiley & Sons, Inc.
1 2 3 4 5 6 7 8 9 10 11 12 | ##predicting the mean petal width of an iris whose petal length is 2.5
ciplot(iris$Petal.Length,iris$Petal.Width,x0=2.5,int="conf")
##predicting a single new observation of the petal width of an iris whose petal length is 2.5
ciplot(iris$Petal.Length,iris$Petal.Width,x0=2.5,int="pred")
##extrapolating the data to predict the mean of the width of an iris's petal whose petal length is 8
ciplot(iris$Petal.Length,iris$Petal.Width,x0=8,int="conf")
##zooming in to the previous graph and removing the dotted red lines
ciplot(iris$Petal.Length,iris$Petal.Width,x0=8,int="conf",show.range=FALSE,
user.xlim=c(7.5,8.5),user.ylim=c(2.6,3.2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.