poly_fit - yband [message #87976] |
Sat, 08 March 2014 04:43  |
gunvicsin11
Messages: 93 Registered: November 2012
|
Member |
|
|
Hello everyone,
I have x 80 integer values and y 80 values.
I did,
p=poly_fit(x,y,7,yband=e,yfit=y1)
now I need y values at every 0.33 intervals so, now I have x with 238 values with 0.33 resolution earlier case the resolution was 1.
Now for this 238 x values I have found 238 y values using the polynomial coefficients.
But now the problem is how to find the error values, since I have yband = e (80 values). But I need to find the error values for all the 238 values.
Is there a way to do this.
Please do help me out in this regard.
thanking you in advance
sid
|
|
|
Re: poly_fit - yband [message #87982 is a reply to message #87976] |
Mon, 10 March 2014 06:15   |
Andy Sayer
Messages: 127 Registered: February 2009
|
Senior Member |
|
|
What do you mean 'error values'?
If you mean the departure of the 'y' variable from the value predicted from the polynomial line, if you only have 80 'real' values of y, you can't interpolate these in x to get 238 values, because that would be inventing data.
Andrew
On Saturday, March 8, 2014 7:43:00 AM UTC-5, sid wrote:
> Hello everyone,
>
> I have x 80 integer values and y 80 values.
>
> I did,
>
> p=poly_fit(x,y,7,yband=e,yfit=y1)
>
>
>
> now I need y values at every 0.33 intervals so, now I have x with 238 values with 0.33 resolution earlier case the resolution was 1.
>
> Now for this 238 x values I have found 238 y values using the polynomial coefficients.
>
> But now the problem is how to find the error values, since I have yband = e (80 values). But I need to find the error values for all the 238 values.
>
>
>
> Is there a way to do this.
>
> Please do help me out in this regard.
>
>
>
> thanking you in advance
>
> sid
|
|
|
Re: poly_fit - yband [message #87984 is a reply to message #87976] |
Mon, 10 March 2014 07:20   |
Russell Ryan
Messages: 122 Registered: May 2012
|
Senior Member |
|
|
On Saturday, March 8, 2014 7:43:00 AM UTC-5, sid wrote:
> Hello everyone,
>
> I have x 80 integer values and y 80 values.
>
> I did,
>
> p=poly_fit(x,y,7,yband=e,yfit=y1)
>
>
>
> now I need y values at every 0.33 intervals so, now I have x with 238 values with 0.33 resolution earlier case the resolution was 1.
>
> Now for this 238 x values I have found 238 y values using the polynomial coefficients.
>
> But now the problem is how to find the error values, since I have yband = e (80 values). But I need to find the error values for all the 238 values.
>
>
>
> Is there a way to do this.
>
> Please do help me out in this regard.
>
>
>
> thanking you in advance
>
> sid
I had to do this for something: I had a set of (x,y,dy) variables to which I fit a polynomial. But then I wanted to make a scatter plot of those data with the best fitting polynomial overplotted and a shaded region showing the range of best fitting polynomials. Of course the model and shaded region can be computed at arbitrary resolution, and so poly_fit does not have a simple means of this. I agree, interpolating is a bad idea. So, why not just read the poly_fit.pro code? That's what I did. It's only about 7 lines worth of rather basic IDL to wade through. In your standard call to poly_fit, you'll need to return the covariance matrix and then do a few basic calculations. It's pretty easy actually...
|
|
|
Re: poly_fit - yband [message #87985 is a reply to message #87976] |
Mon, 10 March 2014 07:33  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Saturday, March 8, 2014 7:43:00 AM UTC-5, sid wrote:
> Hello everyone,
>
> I have x 80 integer values and y 80 values.
>
> I did,
>
> p=poly_fit(x,y,7,yband=e,yfit=y1)
>
>
>
> now I need y values at every 0.33 intervals so, now I have x with 238 values with 0.33 resolution earlier case the resolution was 1.
>
> Now for this 238 x values I have found 238 y values using the polynomial coefficients.
>
> But now the problem is how to find the error values, since I have yband = e (80 values). But I need to find the error values for all the 238 values.
If you decide to switch to the MPFIT family of functions, there is a routine MPPROPERR which can propagate errors of parameters to errors your model function. The included documentation describes what needs to be done.
Craig
http://www.physics.wisc.edu/~craigm/idl/fitting.html
|
|
|