[R] Confidence interval calculation for intersection of two quadratic lines

From: Leif Kirschenbaum <Leif.Kirschenbaum_at_grandisinc.com>
Date: Fri, 18 Jun 2010 11:19:24 -0700

How do I calculate the confidence interval for the value x given by the intersection of two quadratics (i.e. parabolas)?

I fit two quadratics of the form:

  y = C1 + B1*x + A1*x^2
  y = C2 + B2*x + A2*x^2

to two sets of points N1 and N2.

I test for whether they intersect, if they do then I calculate the roots of:   0 = (C1 - C2) + (B1 - B2)*x + (A1 - A2)*x^2

to determine where they intersect and choose the proper root. I have propagated errors through the quadratic equation so that I may calculate the variance of each root.

Naively I might take the variance of the root, find a Student-t quantile for degrees-of-freedom = (N1 + N2 - 6), and then calculate C.I. = root +/- variance * t-quantile

However I have several reservations about this approach:
(1) Let's say that one quadratic fit devolves to a linear fit (A1 ~ 0)*, then I have the intersection of a straight line and a quadratic. (I code this situation separately with different error propagation formulas) However intuitively if the intercept of the straight line varies by some dy up or down I would expect that the intersection with a parabola varies by a different amount if the straight line is moved up versus down, e.g. the confidence interval should be asymmetric.

(2) The variances for the coefficients A1, B1, C1 depend on N1 data points (and A2,B2,C2 on N2) and therefore intuitively it doesn't seem accurate to use a Student-t quantile derived from (N1 + N2). Another way to think of it is if I constructed a linear model:

  x.1  <- x  * (x <  0)
  x.2  <- x  * (x >= 0)
  x2   <- x^2
  x2.1 <- x2 * (x <  0)
  x2.2 <- x2 * (x >= 0)
  mylm <- lm(y ~ x.1 + x.2 + x2.1 + x2.2) 
some coefficients are dependent on N1 data points (and their noise) and other coefficients depend on N2 data points (and their noise). (and I don't think lm would given me an aswer with such bifurcated


Leif S. Kirschenbaum, Ph.D., PMP, CRE

I am developing a test system in LabVIEW, however I simulate data analysis offline in R, i.e. acquire raw data on the test system, import raw data into R and try analysis methods, then port the methods back to the test system. Therefore use of any R functions more sophisticated than lm will be of limited use; LabVIEW does not have very sophisticated statistical functions (thank goodness it includes inverse-t). I have already developed propagation of quadratic fit variances and written my own linear fit confidence interval calculations and now I am extending this to quadratics and to this intersection problem.

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 18 Jun 2010 - 20:48:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Jun 2010 - 20:50:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive