I would like to know if it's possible to add error bars (which I know the value for my experiment) to polyconf function in order to reestimate confidence bounds ?
Thanks in advance !
Best Answer
Aaah, the old heteroscedasticity problem! @Jeremy, here is a sketch of what you need to do. First, you need to switch to a weighted least squares fit. If E is a vector of errors for your data, then your weights should be proportional to
w = E.^(-2);
There are a variety of tools that allow you to do weighted least squares fitting, depending on your problem and which toolboxes you have (seeWeighted Curve Fitting Methods). Then you can call
[Y,DELTA] = polyconf(p,X,S)
where the structure S is described inthe documentation for polyfit. This structure incorporates the information on your error bars.
EDIT: On closer examination, I see thatrobustfit does an iterative weighted least squares for problems where nothing is known about the weights.
Best Answer