补充:我在网上找到了spss中实现BoxCox的源代码:
————————————————————————————
SET LENGTH=NONE.
SET MXLOOP = 100000000.
MATRIX.
GET W/VARIABLES=all/FILE='E:\Program Files\IBM\SPSS\Statistics\21\testdata\income.sav'/missing=omit.
COMPUTE NC=NCOL(W).
COMPUTE NR=NROW(W).
COMPUTE Y=MAKE(NR,1,0).
COMPUTE XX=MAKE(NR,NC,1).
COMPUTE YLAM=MAKE(NR,1,1).
COMPUTE BOXCOX=MAKE(61,2,0).
COMPUTE YTEMP=0.
LOOP II=1 TO NR.
COMPUTE Y(II,1)=W(II,1).
LOOP JJ=1 TO NC-1.
COMPUTE XX(II,JJ+1)=W(II,JJ+1).
END LOOP.
COMPUTE YTEMP=YTEMP+LN(Y(II)).
END LOOP.
LOOP TEMP=1 TO 61.
COMPUTE LAMBDA=-3.1+TEMP*0.1.
DO IF LAMBDA=0.
COMPUTE YLAM(:)=LN(Y(:)).
ELSE.
COMPUTE YLAM(:)=(Y(:)&**LAMBDA-1)/LAMBDA.
END IF.
COMPUTE BETA=INV(T(XX)*XX)*T(XX)*YLAM.
COMPUTE MSE=T(YLAM-XX*BETA)*(YLAM-XX*BETA)/NR.
COMPUTE IDGLIKE=-1*NR/2*LN(MSE)+(LAMB-DA-1)*YTEMP.
COMPUTE BoXCOX(TEMP,1)=LAMBDA.
COMPUTE BOXCOX(TEMP,2)=LOGLIKE.
END LOOP.
SAVE BOXCOX/OUTFILE=*.
END MATRIX.
RENAME VARIABLES COL1=LAMBDA COL2=LOGLlKE.
——————————————————————————————
但是运行到最后提示:INV的源运算数是奇异的
没有输出任何结果,请问这是什么情况啊