!----------------------------------------------------------
!Heterogeneity Model
#NGroups 5

G1
 Calculation
 Begin Matrices;
  L Lower 2 2 Free
  M Full 1 2 Free
 End Matrices;
  Matrix L 1 .2 1
  Matrix M 0 0
 Begin Algebra;
  X=L*L';
 End Algebra;
End

G2
 Data NInputvars=2
 Rectangular File= xy1.rec
 Begin Matrices;  = Group 1
 Means M;
 Covariances X;
 Option RS
 Option MxM=EM1Het.mxm
 Option MxX=EC1Het.mxm
End

G3
 Calculation
 Begin Matrices;
  L Lower 2 2 Free
  M Full 1 2 Free
 End Matrices;
  Matrix L 1 .2 1
  Matrix M 0 0
 Begin Algebra;
  X=L*L';
 End Algebra;
End

G4
 Data NInputvars=2
 Rectangular File= xy2.rec
 Begin Matrices;  = Group 3
 Means M;
 Covariances X;
 Option RS
 Option MxM=EM2Het.mxm
 Option MxX=EC2Het.mxm
End

G5
 Calculation
 Begin Matrices;
  A Full 1 1 =%F2
  B Full 1 1 =%F4
 End Matrices;
 Begin Algebra;
  F= A+B;
 End Algebra;
 Option MxF=LLHet.mxm
 Option Format=(8(1x,F13.7))
End
