Syntax for fitlm: + versus *

2 ビュー (過去 30 日間)
Lydia
Lydia 2019 年 4 月 14 日
コメント済み: Lydia 2019 年 4 月 15 日
What is the difference between the following syntax:
model(10).results = fitlm(tbl,'Acceleration ~ id * Weight');
and
model(10).results = fitlm(tbl,'Acceleration ~ id + Weight');
I am trying to run a linear model but allowing the intercept to vary per the "id" or identity of each observation.
Many thanks!

採用された回答

Walter Roberson
Walter Roberson 2019 年 4 月 15 日
id + Weight includes both id and Weight as linear terms, it appears.
id * Weight includes id, Weight, and id times Weight terms, if I understand correctly.
  1 件のコメント
Lydia
Lydia 2019 年 4 月 15 日
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by