! Genetic Simplex Model
! Weight data in Swedisch twins

G1: genetic structure
Data Calc NGroups=3
Begin Matrices;
X Diag 6 6 Free     ! specific genetic factors
B Diag 5 5 Free     ! genetic transmission paths
Z Diag 6 6 Free     ! specific env specifics
D Diag 5 5 Free     ! specific env transmission paths
I Iden 6 6
J Zero 1 5
L Zero 6 1
End Matrices;
Begin Algebra;
G= (J_B)|L ;
T= (I-G)~ ;
A= T*(X*X')*T' ; 
F= (J_D)|L ;
U= (I-F)~ ;
E= U*(Z*Z')*U' ; 
End Algebra;
End

G2: young female MZ twin pairs
Data NInput_vars=12 NObservations=32
CMatrix Symmetric File=swwtmz.cov
Matrices= Group 1
Covariances A+E | A _
            A   | A+E /
Option RSidual
End 

G3: young female DZ twin pairs
Data NInput_vars=12 NObservations=51
CMatrix Symmetric File=swwtdz.cov
Matrices= Group 1
H Full 1 1
Covariances A+E | H@A _
            H@A | A+E /
Matrix H .5
Start 4 All
Start .4 B 1 1 1 - B 1 5 5   D 1 1 1 - D 1 5 5
Option RSidual
Options NDecimals=4
End
