Re: [R] GLM output problem

2016-09-01 Thread Anderson Eduardo
Embarrassing but that's true. I wrote 'binamial' instead of 'binomial'. I
tried now with the correct spelling and everything is ok, in fact.


> summary(GLM)

Call:
glm(formula = model, family = binomial(link = logit))

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -18.575010.7646  -1.726   0.0844 .
x 5.0403 2.7757   1.816   0.0694 .
I(x^2)   -0.2845 0.1558  -1.826   0.0679 .



Thank you all.

Anderson Eduardo


2016-09-01 5:14 GMT-03:00 peter dalgaard :

> >> 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.
>
>
> More likely, the family= specification got lost and gaussian family
> implied:
>
> > glm(model)
>
> Call:  glm(formula = model)
>
> Coefficients:
> (Intercept)x   I(x^2)
>-0.44608  0.26767 -0.01458
>
> --
> Peter Dalgaard, Professor,
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Office: A 4.23
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>
>
>
>
>
>
>
>
>


-- 
Anderson A. Eduardo
--
Lattes  | Researcher ID
 | Google Acadêmico
 | Site

--

[[alternative HTML version deleted]]

__
R-help@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.

Re: [R] GLM output problem

2016-09-01 Thread peter dalgaard
>> 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.


More likely, the family= specification got lost and gaussian family implied:

> glm(model)

Call:  glm(formula = model)

Coefficients:
(Intercept)x   I(x^2)  
   -0.44608  0.26767 -0.01458  

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@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.


Re: [R] GLM output problem

2016-08-31 Thread Bert Gunter
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
 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  | Researcher ID
>  | Google Acadêmico
>  | Site
> 
> --
> __
> R-help@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.

__
R-help@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.

[R] GLM output problem

2016-08-31 Thread Anderson Eduardo
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  | Researcher ID
 | Google Acadêmico
 | Site

--
__
R-help@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.