Hi Jo,

Next time try prepare a reproducible code.
You have several ways of do that (see Dylan Beaudette) and give a look
below.

x<-1:100
y<-7+x*(sqrt(x*runif(100)))

plot(y~x)

mod1<-glm(y~x)
mod2<-glm(y~x+I(x*x))
curve(mod1$coef[1]+mod1$coef[2]*x, col="red", add=T, lwd=3)
curve(mod2$coef[1]+mod2$coef[2]*x+mod2$coef[3]*x*x, col="green", add=T,
lwd=3)

cheers

milton

On Sun, Jun 7, 2009 at 11:36 PM, Jo Stringer <jstrin...@bses.org.au> wrote:

> Hi!
>
>
> I have fitted two glms assuming a poisson distribution which are:
>
> fit1 <- glm(Aids ~ Year, data=aids, family=poisson())
>
> fit2 <- glm(Aids ~ Year+I(Year^2), data=aids, family=poisson())
>
>
> I am trying to work out how to represent the fitted regression curves of
> fit1 and fit2 on the one graph. I have tried:
>
> graphics.off()
>
> plot(Aids ~ Year, data = aids)
>
>
> line(glm(Aids ~ Year, data=aids, family=poisson()))
> line(glm(Aids ~ Year+I(Year^2), data=aids, family=poisson()))
>
> but this does not work.
>
> Can anyone help me?
>
> Thanks
>
> Jo
>
> BSES Limited Disclaimer
>
>
> --------------------------------------------------------------------------------
>
> This email and any files transmitted with it are confide...{{dropped:15}}
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to