3

I'm trying to replicate a linear discriminant analysis output from SPSS in R, and I'm having difficulties to find a way to perform an m-box test.

The only thing I found was some code posted in a forum, to manually implement the process, but I was wondering if there is nothing for this purpose already incorporated in the language itself.

Sam
  • 6,437
  • 6
  • 33
  • 41
  • I am not familiar with "m-box" tests. Is this terminology specific to SPSS? I have heard of Box-Pierce, Box-Jenkins, and Box-Q tests, but these pertain to autocorrelation. – Richard Herron Aug 03 '10 at 23:22
  • I misspelled the name, it's called Box'm test. Anyway, it is not as commonly used as I though (I'm just starting to learn the subject) probably due to its high sensitivity,as John commented below. It is used to test one of MANOVA assumptions and it seems that the majority of people asking for it are SPSS users, as this software includes it as one of the standard outputs. Just in case someone else is interested, here is the specification of SPSS algorithm: ftp://ftp.spss.com/pub/spss/statistics/spss/algorithms/ap14boxm.pdf (Wikipedia have a definition, but only in the German version) – Sam Aug 04 '10 at 14:15

2 Answers2

2

In package biotools you can find the function boxM(data, grouping). It performs the Box's M-test for homogeneity of covariance matrices obtained from multivariate normal data according to one classification factor. The test is based on the chi-square approximation.

1

There is code that can be found with a simple rseek search. It's not typically done because it's very high sensitivity leads to significant p-values that may not mean much.

EDIT: That old link doesn't work anymore but it turns out that the test is implemented in the biotools package with the function boxM. It was still a relatively easy search. And it's still true that you probably shouldn't bother using it like all such tests. You should probably just carefully examine your covariance matrix and your assumptions.

John
  • 23,360
  • 7
  • 57
  • 83
  • You are right, that is the code I was referring to, but it is manually operating with the matrices, I would want to know if there is a routine already implemented in the language to do that. – Sam Aug 04 '10 at 13:22
  • no is the correct answer... Code is code. What you have there online is a function. Add it to R and now it's part of your R environment. – John Aug 04 '10 at 14:46
  • 1
    I know that it's been a while but the link is broken could you post the code here ? – Matias Andina Nov 04 '15 at 22:09