[R] function for between-groups covariance matrix?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Apr 7 08:24:31 CEST 2008
If this is a large dataset, you probably do not want the covariance matrix
but some decomposition of it. What are you intending to do with it?
If you look at the code for MASS:::lda.default you will see how
discriminant analysis can be done more stably without ever computing the
But if you need it, it is simple: form the group means (see lda.default)
and take their covariance (possibly weighted by group size, depending
which definition you are using).
On Mon, 7 Apr 2008, toby wrote:
> Is anyone aware if there is a function already available that calculates the
> between-groups COvariance matrix, say in a discriminant analysis setting, or in
> a manova setting.
> Maybe as a helper function to some other major function.
> Otherwise I would have to program it myself (probably resulting in some awkward
> code performing horribly on this large dataset).
> Thanks Toby
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
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
More information about the R-help