! Script to estimate haplotype frequencies #ngroups 2 Title estimate freqs Data Ni=1 Begin Matrices; I unit 1 1 T full 1 1 W full 3 4 O full 3 3 ! observed genotype freqs H full 2 2 free ! haplotype freqs End Matrices; Matrix O ! observed freqs 10 15 5 10 50 13 3 13 10 Matrix T 2 Matrix W 1 0 0 0 0 1 1 0 0 0 0 1 Begin Algebra; A = H@H; E = W&A; End Algebra; Matrix h .25 .25 .25 .25 Bound 0 1 H 1 1 to H 2 2 Compute -T. \sum(O.\ln(E)); Option user End Group Constrain haplotype freqs to sum to 1 Constraint Begin Matrices = Group 1; End Matrices; Constrain i=\sum(h); Option rs End Group;