[R] interpolation to abscissa

e-letter inpost at gmail.com
Thu Jan 15 17:31:18 CET 2009


> 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 extrapolation from a linear fit
> of a dataset that is not co-linear?
>
>  > lm(c(0,5) ~ c(16,45))
>
> Call:
> lm(formula = c(0, 5) ~ c(16, 45))
>
> Coefficients:
> (Intercept)    c(16, 45)
>      -2.7586       0.1724
>
> It not that "R is different",  it is merely that I used it differently
> than you used your other tools.
>
> Here's another method ( using all points and again reversing the roles
> of x and y) :
>  > lm(c(0,5,10,15,20) ~ c(16,45,77,101,125))
>
> Call:
> lm(formula = c(0, 5, 10, 15, 20) ~ c(16, 45, 77, 101, 125))
>
> Coefficients:
>              (Intercept)  c(16, 45, 77, 101, 125)
>                  -3.2332                   0.1818
My understanding from gnuplot manual is that a marquart-levenberg
algorithm is used, which I applied to the data to perform a least
squares best fit linear curve. Gnuplot returns values for the
intercept and gradient which I then apply to solve the linear equation
y=mx+c. Similarly with scilab, where the regress(ion?) function was
applied. Qtiplot performed non-weighted linear regression to output
values similar to those from gnuplot.

Why reverse the roles of x and y in your method? Although your revised
value is closer to those from other programs, how do I understand and
explain the discrepancy?




More information about the R-help mailing list