! Mdd meta analysis

#NGroups 31

G1: Model parameters, male
 Calc 
Begin Matrices;
 H Full 1 1
 Q Full 1 1
 X Lower 1 1 Free
 Y Lower 1 1 Free
 Z Lower 1 1 Free
 W Lower 1 1 
End Matrices;
 Matrix H .5
 Matrix Q .25
 Start .6 All
Begin Algebra;
 A= X*X';
 C= Y*Y';
 E= Z*Z';
 D= W*W';
End Algebra;
End

G2: Model parameters, female
Calc
Begin Matrices;
 H Full 1 1
 Q Full 1 1
 X Lower 1 1 Free
 Y Lower 1 1 Free
 Z Lower 1 1 Free
 W Lower 1 1 
End Matrices;
 Matrix H .5
 Matrix Q .25
 Start .6 All
Begin Algebra;
 A= X*X';
 C= Y*Y';
 E= Z*Z';
 D= W*W';
End Algebra;
End

G3:  kenmzf.dat
#include kenmzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Specify T 30 30
Thresholds T;
Covariances A+C+D+E | A+C+D _
            A+C+D   | A+C+D+E /
Options RSidual
End 

G4:  kendzf.dat
#include kendzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Specify T 40 40
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G5: kenmzm.dat
#include kenmzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 50 50
Thresholds T;
Covariances A+C+D+E   | A+C+D _
            A+C+D | A+C+D+E /
Options RSidual
Option Multiple
End

G6:  kendzm.dat
#include kendzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 60 60
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G7:  kendzo.dat
#include kendzo.dat
Begin Matrices= Group 1;
 T Full 2 1
 L Comp = A2
 M Comp = C2
 N Comp = E2
 O Comp = D2
 R Full 1 1 Free  ! this will be parameter # 61
 G Lower 1 1 = X2 
 I Lower 1 1 = Y2
 K Lower 1 1 = W2
End Matrices;
Specify T 40 60
Bound 0 1 R 1 1
Thresholds T;
Covariances A+C+D+E   |  R@H@G*X'+Y*I'+Q@W*K' _
            R@H@X*G'+I*Y'+Q@K*W' | L+M+N+O /
Options RSidual
Option Multiple
End

G8: Constrain male variance
 Constraint NI=1
 Begin Matrices = Group 1;
  U Unit 1 1
 End Matrices;
 Constrain U=A+C+E+D;
End

G9: Constrain female variance
 Constraint NI=1
 Begin Matrices = Group 2;
  U Unit 1 1
 End Matrices;
 Constrain U=A+C+E+D;
 Option Multiple Issat
End


G10:  biemzf.dat
#include biemzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Specify T 100 100
Thresholds T;
Covariances A+C+D+E | A+C+D _
            A+C+D   | A+C+D+E /
Options RSidual
End 

G11:  biedzf.dat
#include biedzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Specify T 110 110
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G12: biemzm.dat
#include biemzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 120 120
Thresholds T;
Covariances A+C+D+E   | A+C+D _
            A+C+D | A+C+D+E /
Options RSidual
Option Multiple
End

G13:  biedzm.dat
#include biedzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 130 130
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G14:  biedzo.dat
#include biedzo.dat
Begin Matrices= Group 1;
 T Full 2 1
 L Comp = A2
 M Comp = C2
 N Comp = E2
 O Comp = D2
 R Full 1 1 Free  ! parameter 131
 G Lower 1 1 = X2 
 I Lower 1 1 = Y2
 K Lower 1 1 = W2
End Matrices;
Specify T 110 130
Bound 0 1 R 1 1
Thresholds T;
Covariances A+C+D+E   |  R@H@G*X'+Y*I'+Q@W*K' _
            R@H@X*G'+I*Y'+Q@K*W' | L+M+N+O /
Options RSidual
Option Multiple
End

G15: lyomzm.dat
#include lyomzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 150 150
Thresholds T;
Covariances A+C+D+E   | A+C+D _
            A+C+D | A+C+D+E /
Options RSidual
Option Multiple
End

G16:  lyodzm.dat
#include lyodzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 160 160
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G17:  swemzf.dat
#include swemzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Specify T 170 170
Thresholds T;
Covariances A+C+D+E | A+C+D _
            A+C+D   | A+C+D+E /
Options RSidual
End 

G18:  swedzf.dat
#include swedzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Specify T 180 180
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G19: swemzm.dat
#include swemzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 190 190
Thresholds T;
Covariances A+C+D+E   | A+C+D _
            A+C+D | A+C+D+E /
Options RSidual
Option Multiple
End

G20: swedzm.dat
#include swedzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Specify T 200 200
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G21:  mcgmzf.dat
#include mcgmzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Matrix T 0.796055 0.796055
Thresholds T;  
Covariances A+C+D+E | A+C+D _
            A+C+D   | A+C+D+E /
Options RSidual
Option Multiple
End

G22:  mcgdzf.dat
#include mcgdzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Matrix T 0.796055 0.796055
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /  
Options RSidual
Option Multiple
End

G23:  mcgmzm.dat
#include mcgmzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Matrix T 1.140687 1.140687
Thresholds T;
Covariances A+C+D+E   | A+C+D _
            A+C+D | A+C+D+E /
Options RSidual
Option Multiple
End

G24:  mcgdzm.dat
#include mcgdzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Matrix T 1.140687 1.140687
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G25:  kenclinmzf.dat
#include kenclinmzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Thresholds T;
Matrix T 0.796055 0.796055 
Covariances A+C+D+E | A+C+D _
            A+C+D   | A+C+D+E /
Options RSidual
End 

G26:  kenclindzf.dat
#include kenclindzf.dat
Begin Matrices= Group 2;
 T Full 2 1
End Matrices;
Matrix T 0.796055 0.796055 
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G27: kenclinmzm.dat
#include kenclinmzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Matrix T 1.140687 1.140687
Thresholds T;
Covariances A+C+D+E   | A+C+D _
            A+C+D | A+C+D+E /
Options RSidual
Option Multiple
End

G28:  kenclindzm.dat
#include kenclindzm.dat
Begin Matrices= Group 1;
 T Full 2 1
End Matrices;
Matrix T 1.140687 1.140687
Thresholds T;
Covariances A+C+D+E   | H@A+C+Q@D _
            H@A+C+Q@D | A+C+D+E /
Options RSidual
Option Multiple
End

G29: kenclindzof.dat
#include kenclindzof.dat
Begin Matrices= Group 2;
 T Full 2 1
 L Comp = A2
 M Comp = C2
 N Comp = E2
 O Comp = D2
 R Full 1 1 Free  ! parameter 201
 G Lower 1 1 = X2 
 I Lower 1 1 = Y2
 K Lower 1 1 = W2
End Matrices;
Bound 0 1 R 1 1
Matrix T 0.796055 1.140687 
Thresholds T;
Covariances A+C+D+E   |  R@H@G*X'+Y*I'+Q@W*K' _
            R@H@X*G'+I*Y'+Q@K*W' | L+M+N+O /
Options RSidual
Option Multiple
End

G30:  kenclindzom.dat
#include kenclindzom.dat
Begin Matrices= Group 2;
 T Full 2 1
 L Comp = A2
 M Comp = C2
 N Comp = E2
 O Comp = D2
 R Full 1 1 =R29  ! parameter 201
 G Lower 1 1 = X2 
 I Lower 1 1 = Y2
 K Lower 1 1 = W2
End Matrices;
Bound 0 1 R 1 1
Matrix T 0.796055 1.140687 
Thresholds T;
Covariances A+C+D+E   |  R@H@G*X'+Y*I'+Q@W*K' _
            R@H@X*G'+I*Y'+Q@K*W' | L+M+N+O /

Options RSidual
Option Multiple
End

G31: Summary
 Calculation
 Begin Matrices = Group 14;
  V Full 1 14
 End Matrices;
 Begin Algebra;
  B = A|C|E|D|L|M|N|O|R|V ;
 End Algebra;

 Specify V 30 40 50 60 100 110 120 130 150 160 170 180 190 200
 Bound -3 3 T 3 1 1  T 4 1 1 T 5 1 1 T 6 1 1 T 7 1 1 T 7 2 1
 Bound -3 3 T 10 1 1  T 11 1 1 T 12 1 1 T 13 1 1 T 14 1 1 T 15 1 1
 Bound -3 3 T 16 1 1  T 17 1 1 T 18 1 1 T 19 1 1 T 20 1 1 
 Option format=(15(F4.2,1x))
 Option append
 Option mxb=commun.mat
 Option issat
End

 save both2.mxs
! equate thresholds across samples

 Specify 10 T 30 30
 Specify 11 T 40 40
 Specify 12 T 50 50
 Specify 13 T 60 60
 Specify 14 T 40 60
 Specify 15 T 50 50
 Specify 16 T 60 60
 Specify 17 T 30 30
 Specify 18 T 40 40
 Specify 19 T 50 50
 Specify 20 T 60 60
  Specify 31 V 0 0 0 0 0 0 0 0 0 0 0 0 0 0
! Specify 31 V 30 40 50 60 30 40 50 60 30 40 50 60 100 110 120 130 150 160 170 180 190 200
! Specify 31 V 30  40  50  60  30  50  60  30  40  50 
!              100 110 120 130 150 160 170 180 190 200

End

! equate mz and dz thresholds within samples
 get both2.mxs
 Specify 4 T 30 30
 Specify 6 T 50 50
 Specify 7 T 30 50
 Specify 11 T 100 100
 Specify 13 T 120 120
 Specify 14 T 100 120
 Specify 16 T 150 150
 Specify 18 T 170 170
 Specify 20 T 190 190
 Specify 31 V 0 0 0 0 0 0 0 0 0 0 0 0 0 0

End

! equate thresholds of OS DZ twins just in community samples
 get both2.mxs
 Specify 7 T 70 75
 Specify 14 T 140 145 
 Specify 31 V 0 0 0 0 0 0 0 0 0 0 0 0 0 0

 Option issat
End

 Specify 7 T 70 70
 Specify 14 T 140 140
 Specify 31 V 0 0 0 0 0 0 0 0 0 0 0 0 0 0

End

! also equate thresholds in the ascertained samples (!?)
! these are merely avg threshold of males & females from NCS

 Matrix 29 T 0.95417 0.95417
 Matrix 30 T 0.95417 0.95417
End

 Get both2.mxs
 Option issat
End

! equate am=af cm=cf em=ef

 Specify 31 V 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 Specify 2 X 1
 Specify 2 Y 2
 Specify 2 Z 3

End
