Suppose I have some data:
y<-c(10, 5, 2, 0, 2, 4, 9) x<-c(-3,-2, -1, 0, 1, 2, 3)
And I want to fit a curve to the data and get a tolerance interval
mylm <- lm(y~poly(x,2,raw=TRUE)) ti <- regtol.int(reg = mylm, new.x = NULL, alpha = 0.1, P = 0.80, side = 2)
I want to determine for my calculated tolerance interval, for what values of x am I going to have y values below the lower bound?
Here's the plotted values, for reference:
So, in my example, I want a y value of at least 4 (so I am only concerned with the lower limit) and I want to find out that I need an x value of less than 2, or greater than two.
Another way of asking my question is, "how can I find every value where the lower tolerance limit crosses a given threshold"?
In reality my data is almost linear (I could get away without using a polynomial) so if that substantially simplifies the problem, I could probably live with it.
On a side note, my plot gives this error:
In if (class(tol.out) == "list" & is.null(names(tol.out)) == FALSE & : the condition has length > 1 and only the first element will be used
Any idea what's causing that?
P.S. I've been thinking - if I could get line up the factor values with the values returned by regtol.int, then I could fit a line to the limits - maybe kludgy, but it would work. But R, behind the scenes, is already doing this when I call plottol... for the life of my I can't figure out where.