Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Linear model fitting discarding outliers
ResourceFunction["TrimmedLinearFit"][data,basis,vars] finds a least-squares linear fit of basis to data when 5% of the outliers are discarded. | |
ResourceFunction["TrimmedLinearFit"][data,basis,vars, n] finds a least-squares linear fit of basis to data when n outliers are discarded. | |
ResourceFunction["TrimmedLinearFit"][data,basis,vars, Scaled[n]] finds a least-squares linear fit of basis to data when a proportion n of outliers are discarded. |
Find a fit ignoring a single outlier:
In[1]:= |
Out[1]= |
Fit would be unduly influenced by the large outlier:
In[2]:= |
Out[2]= |
In this case, TrimmedLinearFit is broadly equivalent to:
In[3]:= |
Out[3]= |
The amount of trimming can be specified as a proportion of the data, for example, discarding 30% of the data:
In[4]:= |
Out[4]= |
Data and models can be multidimensional:
In[5]:= |
Out[5]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License