Greetings. I'm getting started learning R, and I'm trying to reproduce some models I've done previously in SAS. I'm trying to fit simple Poisson regressions, and I keep getting impossible results: the models predict negative numbers of cases for many observations. The code for the models are: Female.model <- glm(Observed ~ Black + Other, family = poisson(link=log), offset=log(PYAR), data=Females) and Male.model <- glm(Observed ~ Black + Other + poly(Minus.log.proportion.moved,3), family = poisson(link=log), offset=log(PYAR), data=Males) where Observed is the number of cases of childhood ALL in a race-gender stratum of a county, Black and Other are Boolean variables what race a race-gender stratum of a county belongs to, Minus.log.proportion.moved is -log(proportion in county who moved between 1985 and 1990), PYAR is person-years at risk for a race-gender stratum of a county, and Females and Males are the data sets for females and males respectively. As far as I can tell, this is set up the same way as examples of Poisson regressions in R I've found on the Net. I've checked, and my data seems to be read in properly (code not shown). Can anyone tell me if there's anything obviously wrong I've missed? Thanks in advance for any help anyone can provide. Aaron Macintosh PowerBook G4 (867 MHz, 1 GB RAM, 40 GB hard drive, Mac OS X 10.3.3, R 1.9.0) ------------- Aaron Solomon佲伃 (佲伂ben Saul Joseph佲伃) 佲伂Adelman E-mail佲伃: 佲伂adelmaas at musc.edu Web site佲伃: 佲伂http佲伃://佲伂people.musc.edu佲伃/佲伂~adelmaas佲伃/佲伂 AOL Instant Messenger佲伃 & 佲伂Yahoo佲伃! 佲伂Messenger: 佲伂Hiergargo AOL chat room: Adelmania
adelmaas at musc.edu writes:> Greetings. > > I'm getting started learning R, and I'm trying to reproduce some > models I've done previously in SAS. I'm trying to fit simple Poisson > regressions, and I keep getting impossible results: the models > predict negative numbers of cases for many observations. The code for > the models are: > > Female.model <- glm(Observed ~ Black + Other, family > poisson(link=log), offset=log(PYAR), data=Females) > > and > > Male.model <- glm(Observed ~ Black + Other + > poly(Minus.log.proportion.moved,3), family = poisson(link=log), > offset=log(PYAR), data=Males) > > where Observed is the number of cases of childhood ALL in a > race-gender stratum of a county, Black and Other are Boolean variables > what race a race-gender stratum of a county belongs to, > Minus.log.proportion.moved is -log(proportion in county who moved > between 1985 and 1990), PYAR is person-years at risk for a race-gender > stratum of a county, and Females and Males are the data sets for > females and males respectively. As far as I can tell, this is set up > the same way as examples of Poisson regressions in R I've found on the > Net. I've checked, and my data seems to be read in properly (code not > shown). Can anyone tell me if there's anything obviously wrong I've > missed? Thanks in advance for any help anyone can provide.You're not telling us what the perceived problem is. What exactly makes you think that the models are predicting negative numbers of cases? Are you using predict() (and if so, on what scale) or what? -p -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907