How to specify covariates in a regression model

北慕城南 提交于 2019-12-02 01:49:19
Roland

I assume that those are dummy encoded factor variables.

If you do the following you can see that you get a perfect fit if you try to model one of your regressors with all others:

regressormod <- lm(p49 ~ . - win.frac, data = dat)
summary(regressormod)$r.sq
#[1] 1

It's (mathematically) impossible to include all coeffcients from dummy-encoded factor variables in a regression model that also includes an intercept (see this answer on Cross Validated). That's why R excludes one factor level by default if you let it do the dummy encoding for you.

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