Skip to content
Prev 314450 / 398506 Next

translate grouped data to their centroid

On 01/01/2013 19:50, Michael Friendly wrote:
Yes.  It is part of the calculation of within-group covariances in LDA, 
so (from MASS:::lda.default)

     group.means <- tapply(x, list(rep(g, p), col(x)), mean)
     x - group.means[g, ]

shows the idiom.