yband help [message #76998] |
Mon, 18 July 2011 16:30 |
Tim Bovaird
Messages: 4 Registered: March 2011
|
Junior Member |
|
|
I'm trying to plot the 68% and 95% standard deviation bands for a fit
I have using poly_fit. In the example below my points form a
polynomial on a log-log plot. x, y and y_err are converted to log
before the fit is calculated then converted back to linear because the
plot is called with the /xlog and /ylog keywords.
xfitlog=findgen(80)/8
logfit=poly_fit(x, y, 3, MEASURE_ERRORS=y_err, YBAND=yband)
yfitlog=logfit[0]+logfit[1]*xfitlog
+logfit[2]*xfitlog^2+logfit[3]*xfitlog^3
yfitlog_errHi=yfitlog+yband
yfitlog_errLo=yfitlog-yband
plot, 10^x, 10^y, /xlog, /ylog
oplot, 10^xfitlog, 10^yfitlog, color=cgcolor('red4'), thick=3
oplot, 10^xfitlog, 10^yfitlog_errHi
oplot, 10^xfitlog, 10^yfitlog_errLo
From the definitions in poly_fit, the fit has a 1 standard deviation
error (68%) of + or - yband. However in my above example, the + and -
errors lie right on top of the fit. Is there something I have done
wrong? Is there a way to also get the 95% errors?
|
|
|