Difference between the interaction : and * term for formulas in StatsModels OLS regression

后端 未结 1 1178
别跟我提以往
别跟我提以往 2021-02-06 09:30

Hi I\'m learning Statsmodel and can\'t figure out the difference between : and * (interaction terms) for formulas in StatsModels OLS regression. Could you please give me a hint

相关标签:
1条回答
  • 2021-02-06 10:25

    ":" will give a regression without the level itself. just the interaction you have mentioned.

    "*" will give a regression with the level itself + the interaction you have mentioned.

    for example

    a. GLMmodel = glm("y ~ a: b" , data = df)

    you'll have only one independent variable which is the results of "a" multiply by "b"

    b. GLMmodel = glm("y ~ a * b" , data = df)

    you'll have 3 independent variables which is the results of "a" multiply by "b" + "a" itself + "b" itself

    0 讨论(0)
提交回复
热议问题