[R] Polynomial Fitting

Rolf Turner r.turner at auckland.ac.nz
Tue Sep 29 02:30:07 CEST 2009


On 29/09/2009, at 10:52 AM, chris carleton wrote:

>
> Hello All,
>
>  This might seem elementary to everyone, but please bear with me. I've
>  just spent some time fitting poly functions to time series data in R
>  using lm() and predict(). I want to analyze the functions once I've
>  fit them to the various data I'm studying. However, after pulling the
>  first function into Octave (just by plotting the polynomial function
>  using fplot() over the same x interval as my original data) I was
>  surprised to see that the scale and y values were vastly different
>  than the ones I have in R. The basic shape of the polynomial over the
>  same interval looks similar in both Octave and R, but the y values  
> are
>  all different. When I compute the y values using the polynomial
>  function by hand, the y values from the Octave plot are returned and
>  not the y values predicted by predict() in R. Can someone explain to
>  me why the values for a function would be different in R? Thanks,
>  Chris Carleton

Presumably because you were using poly() with the argument "raw" left
equal to its default, i.e. FALSE.

	cheers,

		Rolf Turner

P. S.  The posting guide asks for reproducible examples .....

		R. T.

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list