Syntax for fitlm: + versus *

2 vues (au cours des 30 derniers jours)
Lydia
Lydia le 14 Avr 2019
Commenté : Lydia le 15 Avr 2019
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!

Réponse acceptée

Walter Roberson
Walter Roberson le 15 Avr 2019
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 commentaire
Lydia
Lydia le 15 Avr 2019
Thank you very much!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by