I want to fit a linear model by R with family=binomial(link="identity")
, however, binomial family do not have identity link. What should I do?

- 27,560
- 8
- 81
- 248

- 81
- 1
- 3
-
I think there's an underlying statistical issue here. – Glen_b Mar 02 '15 at 05:00
-
yes, the following question will ask about Adjust the standard error for overdispersion. – david Mar 02 '15 at 05:20
-
But for the first one, I need use the identity link in the binomial family, but R does not permit it. – david Mar 02 '15 at 05:22
-
My comment was addressed to people deciding whether or not to close as off topic; I was explaining my vote to leave it open. That a subsequent question will be statistical doesn't impact this question though, which at least on first glance appears to be merely about how to do something in R. A slight rephrase to address the directly statistical issue might make it more clearly on topic here. – Glen_b Mar 02 '15 at 05:22
-
1Note that if you need to both deal with overdispersion *and* use an identity link you should consider going directly to a quasi- model with binomial variance function. An intercept-only binomial model can be fitted *by hand*. – Glen_b Mar 02 '15 at 05:26
-
See Wikipedia on the [linear probability model](http://en.wikipedia.org/wiki/Linear_probability_model) & CV posts [here](http://stats.stackexchange.com/questions/81789) & [here](http://stats.stackexchange.com/questions/104399) for the statistical background. You want `family=quasi(link="identity", variance = "mu(1-mu)")`, if you want it. – Scortchi - Reinstate Monica Mar 02 '15 at 10:42
-
2(And if you wanted the dispersion parameter fixed at one: `family=binomial(link=make.link("identity"))`. – Scortchi - Reinstate Monica Mar 02 '15 at 10:57
-
@Scortchi, why not turn those comments into an official answer? – gung - Reinstate Monica Mar 04 '15 at 17:33
-
@gung: On actually testing the code before posting an answer I found out you don't need `make.link`. – Scortchi - Reinstate Monica Mar 06 '15 at 14:59
1 Answers
See Wikipedia on the linear probability model, & CV posts here & here for the statistical background. Though not "wrong", you'd want a good reason for using an identity link to model a Bernoulli probability.
According to the family
manual
the binomial family [accepts] the links
logit
,probit
,cauchit
, (corresponding to logistic, normal and Cauchy CDFs respectively)log
andcloglog
(complementary log-log)
But
The link and variance arguments have rather awkward semantics for back-compatibility. The recommended way is to supply them is as quoted character strings, but they can also be supplied unquoted (as names or expressions). In addition, they can also be supplied as a length-one character vector giving the name of one of the options, or as a list (for
link
, of class"link-glm"
). The restrictions apply only to links given as names: when given as a character string all the links known tomake.link
are accepted.
So family=binomial(link="identity")
works but family=binomial(link=identity)
doesn't. (If you find differently it might be to do with the R version.) To allow for over-dispersion, then usefamily=quasi(link="identity", variance = "mu(1-mu)")
.

- 27,560
- 8
- 81
- 248
-
the link="identity" vs. link=identity fix was a huge help. This is a workout in Agresti's CDA textbook. The code he provides is the quasi(link...) you discuss, however the simplicity of adding " " is elegant fix. To my understanding the link="identity" call represents the binomial as a linear model. – Justin Peterson Oct 03 '15 at 17:40