Compare Fit of two linear models

8 ビュー (過去 30 日間)
Femke R
Femke R 2020 年 11 月 2 日
コメント済み: Jeff Miller 2020 年 11 月 3 日
Hi guys,
I have a model that looks like this (DV ~ IV1 + IV2)
I also have a nested model where I constrained the coefficients of IV1 and IV2 to be equal. Is there a function I can use to compare the model fit of these two models?
(so I can see if the fit get significantly worse or not in the nested model).
In R I would use CompareFit from the lavaan package, is there something similar for Matlab?
Thanks in advance.

採用された回答

Jeff Miller
Jeff Miller 2020 年 11 月 2 日
A quick and dirty solution is to form a new variable
S=IV1+IV2;
and then compare the fit of the model 'DV~S' to the model 'DV~S+IV2'. If the second model fits significantly better, then you know the constrained model with equal slopes is significantly worse.
  2 件のコメント
Femke R
Femke R 2020 年 11 月 3 日
I've found how to constrain them, I just need to know if there's a way to compare model fit (with significance). To see if the drop in fit is actually significant.
Jeff Miller
Jeff Miller 2020 年 11 月 3 日
X = [S,IV2];
mdl = fitlm(X,DV)
Under the mdl.Coefficients output, you will see a pValue for X2. If this is less than .05 (or whatever your alpha is), then the drop is statistically significant.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGaussian Process Regression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by