Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0306191349010.14814-100000@gannet.stats>
Date: 2003-06-19T12:54:10Z
From: Brian Ripley
Subject: Grouping binary data
In-Reply-To: <5.2.1.1.0.20030619131554.03715238@pop3.norton.antivirus>

On Thu, 19 Jun 2003, Henric Nilsson wrote:

> Dear all,
> 
> I'm analyzing a binary outcome using glm() with a binomial distribution and 
> a logit link, and have now reached the point where I'd like to do some 
> model checking. Since my data are in binary form I'd like to collapse over 
> the cross-classification of the factors before the model checking.
> 
> Are there any nice and simple ways doing this? If so, how? If not, I'd be 
> grateful for receiving some hints on how this can be accomplished.

Look at loglm1.data.frame in package MASS, or xtabs: each work by setting 
up a suitable call to table.

If you want to sum up over cases with the same factors (not what is 
usually meant by collapsing), take a look at multinom (package nnet) which 
has options to do this for multinomials (and Bernoulli is a special case).

-- 
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