[R] GLM output problem

Anderson Eduardo andersonaed at gmail.com
Wed Aug 31 19:03:43 CEST 2016


Hello

I have started to work with GLM and I am facing the following problem:

If I take:

y = c(0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0)
x = 1:18

model = y ~x + I(x^2)
GLM = glm(model, family=binamial(link = logit))

And use the parameters returned by GLM to contruct an equation for the
regression model:

model.eq = -0.446078 + 0.267673*x - 0.014577*I(x^2)

And backtransform it from the logit to the natural scale (using the inverse
link-function for this case):

model.proj = exp(model.eq)/(1+exp(model.eq))

the plot for model.proj~x is not the same of the plot for fitted(GLM)~x
(see the output attached).

Why is this happening? Can someone help me?

Regards,

Anderson Eduardo

 --
Anderson A. Eduardo
------------------------------------------------------------------------------
Lattes <http://lattes.cnpq.br/3826166230581311> | Researcher ID
<http://orcid.org/0000-0001-8045-8043> | Google Acadêmico
<https://scholar.google.com.br/citations?user=oOUjq9IAAAAJ&hl=pt-BR> | Site
<http://andersonaireseduardo.xpg.uol.com.br/>
------------------------------------------------------------------------------


More information about the R-help mailing list