What is the difference between fitlm and fit?

25 visualizzazioni (ultimi 30 giorni)
Gautam
Gautam il 8 Apr 2014
Commentato: Star Strider il 8 Apr 2014
Hello,
_ *fitlm* _ belongs to the Statistics toolbox and is used for linear regression. _ *fit* _ belongs to the Curve-fitting toolbox and is used to fit data to a curve or a surface. However, both use the method of linear regression as default, unless you specify the option of Bisquare, when weighted linear regression is performed. And, they have the same syntax.
Can somebody tell me what the difference between the two functions is, since I am getting different values for the fit coefficients when I perform calculations with fitlm vs those with fit(for the same data set). The coefficients obtained from fit match closest to those obtained by performing linear regression using EES (and to published data, against which I am validating). Kindly refer to the pictures attached.
Code:
if true
% code
%%Calculate the coefficients for power input
model = fitlm([EvaporatingT, CondensingT],Powerinput,'poly33');
%model = fit([EvaporatingT, CondensingT], Powerinput,'poly33')
Powerinputcoeffs = model.Coefficients(:,1);
disp(Powerinputcoeffs)
%%Calculate coefficients for mass flow rate
model2 = fitlm([EvaporatingT, CondensingT], Massflowrate,'poly33');
%model2 = fit([EvaporatingT, CondensingT], Massflowrate, 'poly33')
Mdotcoeffs = model2.Coefficients(:,2);
disp(Mdotcoeffs)
The first image shows the coefficients with fit and the second with fitlm:
Any help would be appreciated, greatly. Thanks very much in advance.
  1 Commento
Star Strider
Star Strider il 8 Apr 2014
The second image shows the standard errors (SE) of the estimated parameters for the various terms, not the estimated parameters themselves.

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by