[R] nonmonotonic glm?
Ben Bolker
bbolker at gmail.com
Sun Jan 11 23:00:04 CET 2015
Stanislav Aggerwal <stan.aggerwal <at> gmail.com> writes:
>
> I have the following problem.
> DV is binomial p
> IV is quantitative variable that goes from negative to positive values.
>
> The data look like this (need nonproportional font to view):
[snip to make gmane happy]
> If these data were symmetrical about zero,
> I could use abs(IV) and do glm(p
> ~ absIV).
> I suppose I could fit two glms, one to positive and one to negative IV
> values. Seems a rather ugly approach.
>
[snip]
What's wrong with a GLM with quadratic terms in the predictor variable?
This is perfectly respectable, well-defined, and easy to implement:
glm(y~poly(x,2),family=binomial,data=...)
or y~x+I(x^2) or y~poly(x,2,raw=TRUE)
> (To complicate things further, this is within-subjects design)
glmer, glmmPQL, glmmML, etc. should all support this just fine.
More information about the R-help
mailing list