Message Boards Message Boards

0
|
3370 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Fitting data with error terms?

Posted 2 years ago
POSTED BY: Ehud Behar
4 Replies
Posted 2 years ago

The problem is that you didn't really add any noise to the response variable. The y's are simply 2*x^2+5. So you end up with a perfect fit no matter what (positive) weights you use.

POSTED BY: Jim Baldwin
Posted 2 years ago

Hi Ehud,

The weights need to be 1 / uncertainty^2 see this. There is no need for Thread, the data is already in the right form.

errors = data /. {_, u_} :> u["Uncertainty"]
nlm = NonlinearModelFit[data, a x^2 + b, {a, b}, x, Weights -> 1/errors^2]

nlm["BestFit"]
(* x^2 (2.00±0.10) + (5.0±1.3) *)
POSTED BY: Rohit Namjoshi
Posted 2 years ago

Thanks very much once again for the help and explanation.

POSTED BY: Ehud Behar
Posted 2 years ago

Do you not believe that you didn't add any errors to the response variable?

Around just characterizes the precision of the observation but it is not the error associated with the response variable.

POSTED BY: Jim Baldwin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract