Rei*_*son 35
您没有说明您打算如何拟合概率模型,但如果它使用R的公式表示法来描述模型,那么您可以提供公式+ 0或- 1作为公式的一部分来抑制截距:
mod <- foo(y ~ 0 + x1 + x2, data = bar)
Run Code Online (Sandbox Code Playgroud)
要么
mod <- foo(y ~ x1 + x2 - 1, data = bar)
Run Code Online (Sandbox Code Playgroud)
(当然都使用伪R代码 - 替换你的建模函数和数据/变量.)
如果这是一个适合的模型,glm()那么类似于:
mod <- glm(y ~ x1 + x2 - 1, data = bar, family = binomial(link = "probit"))
Run Code Online (Sandbox Code Playgroud)
应该这样做(再次在你的数据和变量名称中替换.)
Hea*_*ead 12
此外,如果您有一个现有的公式对象,则foo可以使用以下方法删除截距update:
foo <- y ~ x1 + x2
bar <- update(foo, ~ . -1)
# bar == y ~ x1 + x2 - 1
Run Code Online (Sandbox Code Playgroud)