Search code examples
rspssamos

Why do Malahanobis distances in AMOS not match those in R or SPSS?


With reference to the example data here, the R code

library(stats)
x <- read.csv("example_dat.csv")
Sx <- cov(x)
D2 <- mahalanobis(x, colMeans(x), Sx)

produces Mahalanobis distances that match those which may be obtained from SPSS using the code

DATASET ACTIVATE DataSet2.
COMPUTE RandomNumbers=RV.NORMAL(0,1).
EXECUTE.

REGRESSION
  /MISSING LISTWISE
  /STATISTICS COEFF OUTS R ANOVA
  /CRITERIA=PIN(.05) POUT(.10)
  /NOORIGIN
  /DEPENDENT RandomNumbers
  /METHOD=ENTER Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19 Q20 Q21 Q22 Q23
    Q24 Q25 Q26 Q27 Q28 Q29 Q30
  /SAVE MAHAL.

In SPSS AMOS the Mahalanobis distances are similar, but slightly different. The difference cannot be attributed to rounding error. For instance, the d-squared for observation 9 comes out to be 51.751 in SPSS AMOS, as opposed to 51.480 in both regular SPSS and R.

This is despite the fact that regular SPSS and SPSS AMOS are owned by the same company. There does not seem to be anything in the SPSS AMOS documentation that indicates why they should be different.


Solution

  • SPSS REGRESSION is using N-1 in the denominator in calculating covariance matrix values, while Amos is using N. This is probably the reason for the small differences you're seeing.

    IBM distributes Amos as an SPSS product, but the program is owned and developed by Amos Development Corporation.