Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
307 views
in Technique[技术] by (71.8m points)

How to remove intercept in R

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...