addCI: Add Confidence Interval Lines

View source: R/addCI.R

addCIR Documentation

Add Confidence Interval Lines

Description

Adds confidence interval lines to a simple linear regression or q-normal graph.

Usage

addCI(type, level = 0.95, Plot = list(name = "", what = "lines", type =
  "solid", width = "standard", color = "black"), current = list(yaxis.log
  = FALSE, yaxis.rev = FALSE, xaxis.log = FALSE))

Arguments

type

the type of confidence interval desired. Must be either "SLR" for the confidence interval for a simple linear regression model, which must have been created using the addSLR function or "q-norm" for the confidence interval for a q-normal plot created using qqPlot.

level

the confidence level desired.

Plot

parameters defining the characteristics of the plot. See setPlot for a description of the parameters.

current

the current plot information, normally the output from a high-level graphics function like qqPlot or xyPlot.

Value

The current plot information, the x and y components are the data, not the line. The regression model is included as the lm component.

Note

The equation for the confidence intervals for a simple linear regression model can be found in any textbook on regression, see section 9.4.4 in Helsel and Hirsch (2002) for example.
The confidence interval for a normal distribution is described in Appendix 9 in U.S. Water Resources Council (1982). Owen (1968) describes the application of the noncentral t-distribution for computing the tolerance limits for a normal distribition.

References

Helsel, D.R., and Hirsch, R.M., 2002, Statistical methods in water resources: U.S. Geological Survey Techniques of Water-Resources Investigations, book 4, chap. A3, 522 p.
U.S. Water Resources Council, 1982, Guidelines for determining flood flow frequency, revised September 1981, Editorial Corrections March 1982: Hydrology Committee Bulletin 17B, Washington D.C., 190 p., 1 plate.

See Also

addSLR, qqPlot, addErrorBars

Examples

## Not run: 
set.seed(1)
X <- rnorm(32)
setGD()
AA.pl <- qqPlot(X)
addCI("q-norm", current=AA.pl)
# For more details of addCI see
vignette(topic="GraphAdditions", package="smwrGraphs")

## End(Not run)

USGS-R/smwrGraphs documentation built on Oct. 11, 2022, 6:11 a.m.