Inline.
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Wed, Aug 31, 2016 at 10:03 AM, Anderson Eduardo
<andersonaed at gmail.com> wrote:> 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)
## Not what I got with your data. I got:
Coefficients:
(Intercept) x I(x^2)
-18.5750 5.0403 -0.2845
I suspect you had some other x,y variables lying around when you
defined your model.
-- Bert
>
> 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/>
>
------------------------------------------------------------------------------
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.