An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20050307/957bd047/attachment.pl
generalised linear models
2 messages · Michael Gray, Brian Ripley
On Mon, 7 Mar 2005, Michael Gray wrote:
To whom this may concern, I would be very grateful if someone could give me some advice on where I am going wrong with a logistic regression I am trying to run. I am trying to run a logistic regression on an aggregated data set and have input the command: logistic.mod<-glm(x~Frequency+Location+Sex+Age.Group,family=binomial(link="logit"),data=earsag1.dat) where x is the count of my response and frequency, location, sex and age.group are other variables. However, R gives an error because my values of x are not between 0 and 1. Therefore to compensate for this I denoted y= x/n where n is the number of people in each group and ran the regression logistic.mod<-glm(y~Frequency+Location+Sex+Age.Group,family=binomial(link="logit"),data=earsag1.dat) At this point R told me that my y values were not integer values and hence there was an error. I do not know how, therefore, to set up the logistic regression properly, so I would be very grateful if someone could give me some pointers. If I haven't explained anything well enough, let me know. Thanks very much for your help,
You have forgotten to set the weights=n. The alternative is to have response cbind(x, n-x). See MASS4, p.190.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595