Hi all

Many, maybe all, statistical packages I know of (R, matlab, root, sas) will allow you to fit data with no associated errors, and give you back fit paramters with errors. How is that possible?

Many fit libraries use some form of maximum likelihood, e.g. minimizes chi squared or least squares:

Chi squared measure:\(\chi^2 = \frac{y_i - f(x_i,\alpha)}{\sigma_i^2}\)

Least squares (residuals): \(r_i = y_i - f(x_i,\alpha)\)

EDIT: The below statement (colored red) is wrong. For both of the above measures you can propagate errors on the input data through your minimization and hence obtain the error on your fit parameter \(\alpha\). Just like you can propagate the error on \(a\) and \(a\) onto \(c = \sqrt{a^2 + b^2}\).

What I do not understand is how you propagate an error/uncertainty you do not know. If you data have no errors associated with them, how can you hope to propagate them?

One of them explicitly mentions the error, and then you can just propagate your error though your minimization and you will end up with errors on your fit parameters. But what when you do not mention the error at all, then you cannot propagate anything?

This is from MATLAB:

Plot of data: http://i.imgur.com/fw7ZNIS.png

As can maybe be seen, or guessed, from the snippet, MATLAB fits data without errors, and provides confidence intervals (as good as errors) on the fit parameters. How?

MATLAB says something like:

Does that make sense?

Any input is welcome!

/ Jonas

Many, maybe all, statistical packages I know of (R, matlab, root, sas) will allow you to fit data with no associated errors, and give you back fit paramters with errors. How is that possible?

Many fit libraries use some form of maximum likelihood, e.g. minimizes chi squared or least squares:

Chi squared measure:\(\chi^2 = \frac{y_i - f(x_i,\alpha)}{\sigma_i^2}\)

Least squares (residuals): \(r_i = y_i - f(x_i,\alpha)\)

EDIT: The below statement (colored red) is wrong. For both of the above measures you can propagate errors on the input data through your minimization and hence obtain the error on your fit parameter \(\alpha\). Just like you can propagate the error on \(a\) and \(a\) onto \(c = \sqrt{a^2 + b^2}\).

What I do not understand is how you propagate an error/uncertainty you do not know. If you data have no errors associated with them, how can you hope to propagate them?

One of them explicitly mentions the error, and then you can just propagate your error though your minimization and you will end up with errors on your fit parameters. But what when you do not mention the error at all, then you cannot propagate anything?

This is from MATLAB:

Code:

```
x = 1:20;
y = 2*x + 5;
y = y + normrnd(5,5,1,size(y,2));
plot(x,y,'*-')
fit(x',y','poly1')
> ans =
> Linear model Poly1:
> ans(x) = p1*x + p2
> Coefficients (with 95% confidence bounds):
> p1 = 2 (1.587, 2.413)
> p2 = 11.16 (6.21, 16.11)
```

As can maybe be seen, or guessed, from the snippet, MATLAB fits data without errors, and provides confidence intervals (as good as errors) on the fit parameters. How?

MATLAB says something like:

To calculate confidence bounds, confint uses R^-1 (the inverse R factor from QR decomposition of the Jacobian), the degrees of freedom for error, and the root mean squared error. This information is automatically returned by the fit function and contained within fitresult.

Any input is welcome!

/ Jonas

Last edited: