How to remove intercept in R

Kazo picture Kazo · Jan 8, 2013 · Viewed 72.6k times · Source

I need to create a probit model without the intercept. So, how can I remove the intercept from a probit model in R?

Answer

Gavin Simpson picture Gavin Simpson · Jan 8, 2013

You don't say how you are intending to fit the probit model, but if it uses R's formula notation to describe the model then you can supply either + 0 or - 1 as part of the formula to suppress the intercept:

mod <- foo(y ~ 0 + x1 + x2, data = bar)

or

mod <- foo(y ~ x1 + x2 - 1, data = bar)

(both using pseudo R code of course - substitute your modelling function and data/variables.)

If this is a model fitting by glm() then something like:

mod <- glm(y ~ x1 + x2 - 1, data = bar, family = binomial(link = "probit"))

should do it (again substituting in your data and variable names as appropriate.)