?=================================================================== ? Cox test for nonnested restricted regressions. = ? User must define the first data matrix with the following line: = ? = ? NAMELIST ; X0 = ... $ = ? = ? User must define the data second matrix with the following line: = ? = ? NAMELIST ; X1 = ... $ = ? = ? User's dependent variable is Y. Change the following line = ? = ? CREATE ; Y = the dependent variable $ = ? Define constraints as character strings to be inserted in = ? commands at execution time. = ? = ? STRING ; st0 = ;cls: ... $ null hypothesis = ? STRING ; st1 = ;cls: ... $ alternative = ?=================================================================== PROCEDURE REGRESS ; Lhs = y ; Rhs = x0 ; keep = yh0 "st0" $ MATRIX ; g0 = 1/ssqrd * varb $ CALCULATE ; q0 = sumsqdev ; s0sq = ssqrd $ REGRESS ; Lhs = y ; Rhs = x1 ; keep = yf1 "st1" $ MATRIX ; g1 = 1/ssqrd * varb$ CALCULATE ; q1 = sumsqdev ; s1sq = ssqrd $ REGRESS ; Lhs = yh0 ; Rhs = x1 ; keep = yh10 "st1" $ CALCULATE ; q10 = sumsqdev $ REGRESS ; Lhs = yh10 ; Rhs = x0 "st0" $ CALCULATE ; q100 = sumsqdev $ MATRIX ; h0 = rank(G0) ; h1 = rank(G1) $ CALCULATE ; m0 = col(X0) - h0 ; m1 = col(X1) - h1 ; d0 = n - h0 ; d1 = n - h1 $ MATRIX ; x1x0 = xdot(x1,x0) ; x0x1 = x1x0' ; x0x0 = xdot(x0) ; x1x1 = xdot(x1) ; T0T1 = G0 | X0X1 | G1 | X1X0 ; TRT0T1 = trce(T0T1) ; T0T1SQ = T0T1 | T0T1 ; TRT0T1SQ=trce(T0T1SQ) $ CALCULATE ; TRB0SQ = h1 - TRT0T1SQ - (h1 - TRT0T1)^2 / d0 $ MATRIX ; g0x0x0 = g0 | x0x0 ;TRT0 = trce(G0X0X0) ; g1x1x1 = g1 | x1x1 ;TRT1 = trce(G1X1X1) $ CALCULATE ; trs0s1 = n - trt0 - trt1 + trt0t1 ; s10sq=(q10 + s0sq*trs0s1)/d1 ; w0 = (q1 - q0 - q10) / sqr(4 * q0 * q100/n) ; w0t = d1 * (s1sq - s10sq) / sqr(s1sq ^ 2 * 2 * trb0sq + 4 * s1sq * q100) ; n0 = n/2 * log(s1sq/s10sq) / sqr(4*q100*s0sq/s10sq^2)$ ; n0t = .5 * d1 * log(s1sq/s10sq) / sqr( (q100 + .5* s0sq * trb0sq) * s0sq/s10sq^2) $ ENDPROCEDURE EXECUTE