! Script for estimating Polychoric correlations : correlation between variables with three or more categories
! 3 categories: 2 Thresholds per liability, two for twin1 and two for twin2
! 0 = bottom 22% (non-agressive at all)
! 1 = mid 66% (sometimes agressive)
! 2 = top 12% (very agressive)
! Equality in Thresholds are tested across twins within each groups and across zygosity group.
! THRESHOLD MATRIX 2x2 :
! T(1,1) T(1,2) = threshold 1 of twin1 and twin2
! T(2,1) T(2,2) = threshold 2 of twin1 and twin2
#define nvar 2 ! number of variables
#define nthresh 2 ! number of thresholds
G1: Data and model for MZ correlation
DAta NGroups=2 NInput_vars=3
Missing=.
Ordinal File=cat.dat
Labels
zyg bin1 bin2
SELECT IF zyg = 1
SELECT bin1 bin2 /
BEGIN MATRICES;
R STAN 2 2 FREE !Correlation matrix
T FULL nthresh nvar FREE !thresh tw1, thresh tw2
L Lower nthresh nthresh
End matrices;
Value 1 L 1 1 to L nthresh nthresh ! initialize L
COV R / !Predicted Correlation matrix for MZ pairs
Thresholds L*T ; !to ensure t1>t2>t3 etc.......
Matrix T
-1 -1 !starting values for the first thresholds
2 2 !start values for the increment in threshold
MA R .6 !starting value for the correlation
interval @95 R 2 1 !requests the 95%CI for the MZ correlation
Option RS
END
G2: Data and model for DZ correlation
DAta NInput_vars=3
Missing=.
Ordinal File=cat.dat
Labels
zyg bin1 bin2
SELECT IF zyg = 2
SELECT bin1 bin2 /
BEGIN MATRICES;
R STAN 2 2 FREE !Correlation matrix
T FULL nthresh nvar FREE !thresh tw1, thresh tw2
L Lower nthresh nthresh =L1
End matrices;
COV R / !Predicted Correlation matrix for DZ pairs
Thresholds L*T ; !to ensure t1>t2>t3 etc.......
Matrix T
-1 -1 !starting values for the first thresholds
2 2 !start values for the increment in threshold
MA R .4 !starting value for the correlation
interval @95 R 2 1 !requests the 95%CI for the DZ correlation
Option func=1.E-10 !function precision is less than usual
Option rs issat Multiple
End Group;
Save cor.mxs !this saves the full model so you can test reduced models
Get cor.mxs
EQ T 1 1 1 T 1 1 2 !constrain TH 1 to be equal across MZ twins (twin1/twin2)
EQ T 1 2 1 T 1 2 2 !constrain TH 2 to be equal across MZ twins (twin1/twin2)
end group;
Get cor.mxs
EQ T 2 1 1 T 2 1 2 !constrain TH 1 to be equal across DZ twins (twin1/twin2)
EQ T 2 2 1 T 2 2 2 !constrain TH 2 to be equal across DZ twins (twin1/twin2)
end group;
!constrain TH to be equal across twins and zygosity
Get cor.mxs
EQ T 1 1 1 T 1 1 2 T 2 1 1 T 2 1 2 !constrain TH 1 to be equal across twins and groups
EQ T 1 2 1 T 1 2 2 T 2 2 1 T 2 2 2 !constrain TH 2 to be equal across twins and groups
end group;