File: two.mx

package info (click to toggle)
r-cran-openmx 2.21.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,412 kB
  • sloc: cpp: 36,577; ansic: 13,811; fortran: 2,001; sh: 1,440; python: 350; perl: 21; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 714 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
!     
!  Maximum Likelihood Example
!
!     Bernstein data on ABO blood-groups
!     c.f. Edwards, AWF (1972)  Likelihood.  Cambridge Univ Press, pp. 39-41
!
#ngroups 1
ABO two locus
 Data NInput=1
 Begin Matrices;
  P Full 1 1 Free ! allele freq loc 1
  S Full 1 1 Free ! allele freq loc 2
  I Unit 1 1
  D Full 1 1
  O Full 4 1      ! observed data
 End Matrices;

  Matrix D 2
  Matrix O 212 103 39 148
  Bound 0 1 P 1 1 S 1 1
  Start .5 P 1 1  S 1 1
  
 Begin Algebra;
  Q = I - P;
  T = I - S;
  E = (P*P+D*P*Q)*T*T_
      (Q*Q)*(S*S+D*S*T)_
      (P*P+D*P*Q)*(S*S+D*S*T)_
      (Q*Q)*(T*T);
F=\sum(O)@E;
 End Algebra;

 Compute -\sum(\ln(E).O);
 Option User-Defined
End