[R] question about GLM
Ben Bolker
bolker at ufl.edu
Wed Sep 3 00:10:46 CEST 2008
Aiste Aistike <aiste.aistike <at> gmail.com> writes:
>
> Hello R-users,
>
> I do not have much knowledge about generalized linear models therefore my
> question maybe quite stupid.
>
> I have data from 20 towns with their population and number of people with an
> illness from those towns. I would like to use glm function in R so I
> can calculate proportions of ill people (and later on produce confidence
> intervals). I also want to compare those with original proportions of ill
> people.
>
> If I use:
>
> model1 <- glm(ill ~ offset(log(total)), family = poisson)
> # ill - number of people with illness
> #total - total number of people
>
> with predict.glm I could get number of people (count data), but not the
> proportions. If the obtained number I divide by 'total', I get the same
> proportion for everyone. But what I want is a way of modeling proportions.
> This probably requires to fit a different model but my lack of knowledge
> isn't helping here.
>
Not stupid -- but -- wouldn't a binomial model
glm(cbind(ill,total-ill) ~ 1, family=binomial)
make more sense?
Read ?predict.glm carefully to determine whether you
are predicting responses on the linear predictor (=log-odds)
scale or the original scale
Ben Bolker
More information about the R-help
mailing list