On Mar 25, 2009, at 2:22 PM, David Winsemius wrote:
On Mar 25, 2009, at 8:37 AM, Greg wrote:
Forgive me for not being more clear.
Would you expect that one y
value returns more than one x? I don't
No, I don't either. I want to know the value of that x, however.
For
example:
x <- c(2.743, 3.019, 3.329, 3.583, 4.017)
y <- c(0.000, 0.025, 0.025, 0.158, 1.000)
I would like to know the value of x when y is 0.1 and 0.9. If I try
to
"trick" approx() to give the answer I'm looking for by switching x
& y
(e.g., approx(y, x)) the (perfectly reasonable) warning, "In
approx(y,
x, c(0.1, 0.9)) : collapsing to unique 'x' values" is thrown.
?lm
?predict
>
1 2 3 4 5
3.104855 3.129001 3.129001 3.257457 4.070686
I realized in looking at this again that specific predictions were
requested and these would come from:
predict(lm(x ~ y), newdata = list(y = c(0.1, 0.9) ) )
1 2
3.201438 3.974103
Note, of course, that the regression of x on y will not be the
precise inverse of the regression of y on x.
I'm simply wondering if it's possible to interpolate to an x-axis--
similar to approx()'s behaviour to interpolate to a y-axis, but in
reverse.
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@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.