Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove intercept in R

Tags:

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

like image 243
Kazo Avatar asked Jan 08 '13 14:01

Kazo


People also ask

How do you remove intercepts in R?

So, how can I remove the intercept from a probit model in R? Just add a -1 in your formula as in: glm(y ~ x1 + x2 - 1, family = binomial(link = "probit"), data = yourdata) this will estimate a probit model without intercept.

What is the intercept in R?

The intercept (often labeled as constant) is the point where the function crosses the y-axis. In some analysis, the regression model only becomes significant when we remove the intercept, and the regression line reduces to Y = bX + error.

Why do we include intercept in regression?

Most multiple regression models include a constant term (i.e., the intercept), since this ensures that the model will be unbiased--i.e., the mean of the residuals will be exactly zero. (The coefficients in a regression model are estimated by least squares--i.e., minimizing the mean squared error.


1 Answers

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.)

like image 62
Gavin Simpson Avatar answered Sep 20 '22 15:09

Gavin Simpson