What is the difference between fitlm and fit?

16 ビュー (過去 30 日間)
Gautam
Gautam 2014 年 4 月 8 日
コメント済み: Star Strider 2014 年 4 月 8 日
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 件のコメント
Star Strider
Star Strider 2014 年 4 月 8 日
The second image shows the standard errors (SE) of the estimated parameters for the various terms, not the estimated parameters themselves.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by