FAQ/probitmac - CBU statistics Wiki
location: FAQ / probitmac

SPSS macro for probit regression with one covariate

This macro produces the covariate value and its 95% fiducial confidence limit as described in Finney (1971) corresponding to a proportion, p, in N response proportions.

NB: You need to enter the heterogeneity residual chi-square (available from PROBIT)and say if it is signficant (HET=1) or not (HET=0). This macro works OK in version 13 of SPSS but tabular labels referred to in the below OMS commands may differ in later versions. The data needs to entered in the format below in three columns labelled A, B and C.

A

B

C

1

1

837

29

2

837

2

1

1020

28

2

1020

7

1

1243

23

2

1243

12

1

1515

18

2

1515

17

1

1847

13

2

1847

19

1

2252

11

2

2252

20

1

2745

10

2

2745

It is assumed in the below that there are three columns labelled A (frequency), B (dichotomous group indicator) and C (covariate).

DEFINE !PMAC (P= !TOKENS(1) /HET= !TOKENS(1) /CHISQ=!TOKENS(1) /N=!TOKENS(1)).

WEIGHT BY A.

OMS 
/SELECT TABLES 
/IF SUBTYPES=['Asymptotic Covariance Matrix'] 
/DESTINATION FORMAT=SAV OUTFILE='c:\probit2.sav'
/COLUMNS SEQUENCE=[C1, R1]. 

PLUM
B WITH C
/LINK = PROBIT
/PRINT = PARAMETER COVB.

OMSEND.


OMS 
/SELECT TABLES 
/IF SUBTYPES=['Parameter Estimates'] 
/DESTINATION FORMAT=SAV OUTFILE='c:\probit.sav'
/COLUMNS SEQUENCE=[C1, R1]. 

PLUM
B WITH C
/LINK = PROBIT
/PRINT = PARAMETER COVB.

OMSEND.

GET FILE='c:\probit.sav'.
exe.

SAVE OUTFILE='C:\PROBIT3.SAV' 
 /DROP=Subtype_ to Label_ Wald_B1.00 to UpperBound_C
 /RENAME=(Estimate_B1.00 Estimate_C Std.Error_B1.00 Std.Error_C = int b seint seb).
exe.

get file='C:\probit3.sav'.
MATCH FILES /FILE=* /FILE='C:\PROBIT2.SAV' /by Command_.
exe.

SAVE OUTFILE='C:\PROBIT4.SAV' 
 /DROP=Command_ Subtype_ to Label_  B1.00_B1.00 C_B1.00 C_C
 /RENAME=(B1.00_C = cov).
exe.

GET FILE='C:\PROBIT4.SAV'.
COMPUTE B= -B.
EXE.

SELECT IF ($CASENUM = 1).
COMPUTE PREDX= (PROBIT(!P)-INT)/B.

IF (!HET=0) T=1.96.
IF (!HET=1) T=IDF.T(0.025,!N-2).

COMPUTE H=(!CHISQ)/(!N-2). 
COMPUTE H2= (T*T*SEB*SEB)/(B*B).
EXE.


IF (!HET=0) HS=1.
IF (!HET=1) HS=H.
IF (!HET=0) G= H2.
IF (!HET=1) G= H*H2.
EXE.

COMPUTE CI1=(G/(1-G)).
COMPUTE CI2=PREDX+(CI1*(PREDX-(COV/(SEB*SEB)))).
COMPUTE SEX1= T/(B*(1-G)).
COMPUTE SEX2= SEINT*SEINT - 2*PREDX*COV + PREDX*PREDX*SEB*SEB.
COMPUTE SEX3=G*(SEINT*SEINT-((COV*COV)/(SEB*SEB))).

COMPUTE SEX= SEX1*SQRT(HS*(SEX2-SEX3)).
COMPUTE CI95LX = CI2 + SEX.
COMPUTE CI95UX = CI2 - SEX.
LIST VARIABLES PREDX CI95LX CI95UX.

!ENDDEFINE.

which can be run in the data file using a macro call of the form below substituting the inputs as desired.

!PMAC P=0.50 HET=1 CHISQ=9.613 N=7.

Running the above with the inputs appropriate for the above data gives a median covariate value of 2008.07 with a 95% Confidence interval of 1689.28 to 2550.05 which cloely agrees with that produced by the probit regression procedure of 1688.92 to 2531.83.

None: FAQ/probitmac (last edited 2013-03-08 10:17:39 by localhost)