Re: [R] generalised linear models

From: Prof Brian Ripley <>
Date: Tue 08 Mar 2005 - 05:30:57 EST

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
> 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,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Tue Mar 08 05:45:13 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST