“ * ” vs “ : ” in R for modelling [closed]

不问归期 提交于 2019-12-31 13:13:44

问题


I'm sure this question must have been asked but I have no luck finding it in the archives. Anyways, I always thought that " : " or " * " meant the same thing when adding interaction terms. For example:

amount of gas ~ temperature * gas type amount of gas ~ temperature:gas type

However, now that I've started using GLMs I see that these generate different AIC scores, different estimates etc. when I switch between the two. Can anyone explain to me why this happens? Is it a problem with the stats package in R?

Thank you!


回答1:


From help(formula):

 In addition to ‘+’ and ‘:’, a number of other operators are useful
 in model formulae.  The ‘*’ operator denotes factor crossing:
 ‘a*b’ interpreted as ‘a+b+a:b’.


来源:https://stackoverflow.com/questions/40567421/vs-in-r-for-modelling

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!