Syntax for fitlm: + versus *

조회 수: 8 (최근 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 CenterFile Exchange에서 Linear Regression에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by