Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Perform linear and nonlinear fits on data with error bars
ResourceFunction["FitWithErrors"][LinearModelFit[data,basis,vars]] performs a LinearModelFit on data with Around values by finding the appropriate Weights option value based on the uncertainties in data. | |
ResourceFunction["FitWithErrors"][NonlinearModelFit[data,form,params,vars]] performs a NonlinearModelFit on data with Around values. | |
ResourceFunction["FitWithErrors"][expr,n] limits the algorithm to n iterations to find the weights. |
Fit a linear model to some data with errors in the response variable:
In[1]:= |
Out[2]= |
In[3]:= |
Out[3]= |
Fit data with uncertainties in both x and y:
In[4]:= |
Out[5]= |
In[6]:= |
Out[6]= |
If one of the rows of the input data does not have any uncertainty, it's not possible to calculate the weights for that row and the fit will fail:
In[10]:= |
Out[10]= |
Mixing x errors with y errors does work because it's still possible to compute a weight for each row:
In[11]:= |
Out[11]= |
Only vector and matrix inputs are currently supported:
In[12]:= |
In[13]:= |
Non-symmetric Around values are not supported:
In[14]:= |
Out[14]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License