Description Usage Arguments Details Value See Also Examples
View source: R/testsPostHoc-utils.R
Shows the predicted value and interval on a fitted line plot. This function is used to illustrate predictions with SLR or IVR models and to show distinctions between confidence and prediction intervals.
1 2 3 4 5 6 7 8 9 10 11 12 | predictPlot(...)
predictionPlot(
mdl,
newdata,
interval = "prediction",
conf.level = 0.95,
lty = 1,
lwd = 3,
legend = "topright",
...
)
|
... |
Other arguments to the |
mdl |
an |
newdata |
A data frame in which to look for variables with which to predict. This cannot be omitted as it is with |
interval |
a string indicating whether to plot confidence ( |
conf.level |
a decimal numeric indicating the level of confidence to use for confidence and prediction intervals (default is |
lty |
a numeric indicating the type of line used for representing the intervals (see |
lwd |
a numeric indicating the width of line used for representing the intervals (see |
legend |
Controls use and placement of the legend (see details in |
This function produces a fitted line plot with both confidence and prediction bands shown. It then constructs vertical bars representing the predicted values with the corresponding interval (chosen with interval) for all observations found in newdata.
This function is only appropriate for SLR and IVR with a single quantitative covariate and two or fewer factors.
The predictPlot() is just a pass-through to predictionPlot().
A data.frame is returned that contains the number of the new observation (for comparison to the graphic that is produced), the values of the variables in newdata, and the predicted values at those observed values.
predict specifically predict.lm and fitPlot from FSA.
1 2 3 4 5 6 7 8 9 10 | lm1 <- lm(Sepal.Length~Petal.Length*Species,data=iris)
lm2 <- lm(Sepal.Length~Petal.Length+Species,data=iris)
lm3 <- lm(Sepal.Length~Petal.Length,data=iris)
op <- par(mfrow=c(2,2),mar=c(3,3,2,1),mgp=c(2,0.7,0))
newdf <- data.frame(Petal.Length=c(2,4),Species=c("setosa","versicolor"))
predictionPlot(lm1,newdf,legend="topleft")
predictionPlot(lm2,newdf,legend="topleft")
predictionPlot(lm3,newdf)
predictionPlot(lm3,newdf,interval="confidence")
par(op)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.