Re: [R] interpolation to abscissa

2009-01-15 Thread David Winsemius
It appears the answer to your goal after a discursive exploration of "interpolation", which was really extrapolation, is that you need to look at the predict methods for linear (and other sorts as well) models. ?predict ?predict.lm > y <- c(16,45,77,101,125) > x <- c(0,5,10,15,20) > > lmmo

Re: [R] interpolation to abscissa

2009-01-15 Thread David Winsemius
On Jan 15, 2009, at 11:31 AM, e-letter wrote: Perhaps a coding error on my part (or on your part). Perhaps different methods (none of which you describe)? I suspect that my method only used the first two points (I just checked by plotting and -2.7 is closer to the paper and pen result I g

Re: [R] interpolation to abscissa

2009-01-15 Thread e-letter
> Perhaps a coding error on my part (or on your part). Perhaps different > methods (none of which you describe)? > > I suspect that my method only used the first two points (I just > checked by plotting and -2.7 is closer to the paper and pen result I > get than is -3.28. Perhaps you made an extra

Re: [R] interpolation to abscissa

2009-01-15 Thread David Winsemius
On Jan 15, 2009, at 10:04 AM, e-letter wrote: On 13/01/2009, David Winsemius wrote: It's fairly clear from the documentation that approxfun() will not extrapolate. help.search("extrapolate") library(Hmisc) ?approxExtrap Some sort of minimization approach: approxExtrap(x=c(0,5,10,15,20),

Re: [R] interpolation to abscissa

2009-01-15 Thread e-letter
On 13/01/2009, David Winsemius wrote: > It's fairly clear from the documentation that approxfun() will not > extrapolate. > > help.search("extrapolate") > library(Hmisc) > ?approxExtrap > > Some sort of minimization approach: > > > approxExtrap(x=c(0,5,10,15,20), y=c(16,45,77,101,125),xout=c(-4,0

Re: [R] interpolation to abscissa

2009-01-13 Thread David Winsemius
It's fairly clear from the documentation that approxfun() will not extrapolate. help.search("extrapolate") library(Hmisc) ?approxExtrap Some sort of minimization approach: > approxExtrap(x=c(0,5,10,15,20), y=c(16,45,77,101,125),xout=c(-4,0,4)) $x [1] -4 0 4 $y [1] -7.2 16.0 39.2 > approxE

Re: [R] interpolation to abscissa

2009-01-13 Thread e-letter
> > What is the problem that you are trying to solve? > >From the data I provided: x=c(0,5,10,15,20) y=c(16,45,77,101,125); I want to obtain the value of x when y=0. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] interpolation to abscissa

2009-01-13 Thread jim holtman
approxfun returns a function; that is not an error message: > x=c(0,5,10,15,20) > y=c(16,45,77,101,125) > > approx(x,y,method="linear") $x [1] 0.000 0.4081633 0.8163265 1.2244898 1.6326531 2.0408163 2.4489796 2.8571429 3.2653061 [10] 3.6734694 4.0816327 4.4897959 4.8979592 5.306

Re: [R] interpolation to abscissa

2009-01-13 Thread e-letter
On 08/01/2009, Greg Snow wrote: > If you want to just linearly interpolate, then use the functions approx or > approxfun from the stats package (one of those that is loaded by default). I have read the guide for approx and approxfun functions. Below is my data. x=c(0,5,10,15,20) y=c(16,45,77,101,

Re: [R] interpolation to abscissa

2009-01-08 Thread Greg Snow
8, 2009 9:22 AM > To: r-help@r-project.org > Subject: [R] interpolation to abscissa > > Readers, > > I have looked at various documents hosted on the web site; I couldn't > find anything on interpolation. So I started r and accessed the help > (help.start()). (by the

[R] interpolation to abscissa

2009-01-08 Thread e-letter
Readers, I have looked at various documents hosted on the web site; I couldn't find anything on interpolation. So I started r and accessed the help (help.start()). (by the way is it possible to configure r to open help in opera instead of firefox?) Initially I read the help for the akima package b