MATLAB - Find the error on polynomial fit parameters of experimental data

Click For Summary
SUMMARY

This discussion focuses on calculating errors in polynomial fit parameters using MATLAB's polyfit and polyval functions. The command [p,S] = polyfit(x,y,n) returns polynomial coefficients and a structure S that contains essential fields for error estimation. The covariance matrix of the fit parameters can be calculated using the formula (Rinv*Rinv')*normr^2/df, where Rinv is the inverse of the triangular factor from the QR decomposition. Additionally, y,delta = polyval(p,x,S) provides error estimates for future observations, ensuring that the predictions account for at least 50% of the data variability.

PREREQUISITES
  • Understanding of MATLAB programming
  • Familiarity with polynomial fitting concepts
  • Knowledge of QR decomposition
  • Basic statistics, particularly regarding covariance and standard deviation
NEXT STEPS
  • Explore MATLAB's polyfit documentation for detailed examples
  • Learn about QR decomposition and its applications in numerical analysis
  • Investigate the implications of covariance matrices in statistical modeling
  • Study error analysis techniques in regression models
USEFUL FOR

This discussion is beneficial for data analysts, researchers, and engineers who utilize MATLAB for data fitting and require accurate error estimation in their polynomial models.

SK1.618
Messages
8
Reaction score
0
See attached PDF for details: How do I calculate errors on the fit parameters, p?
 

Attachments

Physics news on Phys.org
Check out the doc on polyfit and polyval. In particular,

[p,S] = polyfit(x,y,n) returns the polynomial coefficients p and a structure S for use with polyval to obtain error estimates or predictions. Structure S contains fields R, df, and normr, for the triangular factor from a QR decomposition of the Vandermonde matrix of x, the degrees of freedom, and the norm of the residuals, respectively. If the data y are random, an estimate of the covariance matrix of p is (Rinv*Rinv')*normr^2/df, where Rinv is the inverse of R. If the errors in the data y are independent normal with constant variance, polyval produces error bounds that contain at least 50% of the predictions.

[y,delta] = polyval(p,x,S) uses the optional output structure S generated by polyfit to generate error estimates delta. delta is an estimate of the standard deviation of the error in predicting a future observation at x by p(x). If the coefficients in p are least squares estimates computed by polyfit, and the errors in the data input to polyfit are independent, normal, and have constant variance, then y±delta contains at least 50% of the predictions of future observations at x.

There is also a good example on the polyfit page.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 12 ·
Replies
12
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K