! General Model for GxE Interaction
! Depression in Australian twins

G1: singles model parameters
Data Calc NGroups=8
Begin Matrices;
X Lower 1 1 Free    ! genetic structure
Z Lower 1 1 Free    ! specific environmental structure
W Lower 1 1 Free    ! dominance structure
End Matrices;
Begin Algebra;
A= X*X' ;
E= Z*Z' ;
D= W*W' ;
End Algebra;
End

G2: married model parameters
Data Calc
Begin Matrices;
X Lower 1 1 Free    ! genetic structure
Z Lower 1 1 Free    ! specific environmental structure
W Lower 1 1 Free    ! dominance structure
N Lower 1 1 Free    ! set of genes for married couples
End Matrices;
Begin Algebra;
A= X*X' ;
E= Z*Z' ;
D= W*W' ;
M= N&N' ;
End Algebra;
End

G3: Concordant single MZ twin pairs
Data NInput_vars=2 NObservations=254
Labels dep_t1 bmi-t2
CMatrix Symmetric File=ozdepsmz.cov
Matrices= Group 1
Covariances A+D+E | A+D _
            A+D   | A+D+E /
Option RSidual
End 

G4: Concordant single DZ twin pairs
Data NInput_vars=2 NObservations=155
Labels dep_t1 bmi-t2
CMatrix Symmetric File=ozdepsdz.cov
Matrices= Group 1
H Full 1 1
Q Full 1 1
Covariances A+D+E   | H@A+Q@D _
            H@A+Q@D | A+D+E /
Matrix H .5
Matrix Q .25
Option RSidual
End

G5: Concordant married MZ twin pairs
Data NInput_vars=2 NObservations=177
Labels dep_t1 bmi-t2
CMatrix Symmetric File=ozdepmmz.cov
Matrices= Group 2
Covariances A+D+E+M | A+D+M _
            A+D+M   | A+D+E+M /
Option RSidual
End 

G6: Concordant married DZ twin pairs
Data NInput_vars=2 NObservations=107
Labels dep_t1 bmi-t2
CMatrix Symmetric File=ozdepmdz.cov
Matrices= Group 2
H Full 1 1 = H4
Q Full 1 1 = Q4
Covariances A+D+E+M     | H@A+Q@D+H@M _
            H@A+Q@D+H@M | A+D+E+M   /
Option RSidual
End

G7: Discordant MZ twin pairs
Data NInput_vars=2 NObservations=139
Labels dep_t1 bmi-t2
CMatrix Symmetric File=ozdepdmz.cov
Matrices= Group 1
J Symm 1 1 = A2
K Symm 1 1 = D2
L Symm 1 1 = E2
M Symm 1 1 = M2
Covariances A+D+E  | (\sqrt(A*J))+(\sqrt(D*K)) _
            (\sqrt(A*J))+(\sqrt(D*K)) | J+K+L+M   /
Option RSidual
End

G8: Discordant DZ twin pairs
Data NInput_vars=2 NObservations=87
Labels dep_t1 bmi-t2
CMatrix Symmetric File=ozdepddz.cov
Matrices= Group 7
H Full 1 1 = H4
Q Full 1 1 = Q4
Covariances A+D+E | H@(\sqrt(A*J))+Q@(\sqrt(D*K)) _
            H@(\sqrt(A*J))+Q@(\sqrt(D*K)) | J+K+L+M   /
Start .7 All
Option RSidual NDecimals=4
End
