Diff for "FAQ/probitmac" - CBU statistics Wiki
location: Diff for "FAQ/probitmac"
Differences between revisions 2 and 3
Revision 2 as of 2008-08-13 15:44:05
Size: 2817
Editor: PeterWatson
Comment:
Revision 3 as of 2008-08-13 15:44:46
Size: 2826
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 109: Line 109:
which can be run in the data file by typing something of form substituting the inputs as desired. which can be run in the data file using a macro call of the form below substituting the inputs as desired.

SPSS macro for probit regression with one covariate

This macro produces the covariate value and its 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.

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