(*:Mathematica:: V2.1 *) (*:Context:: "exgen`" *) (*Title: genetic linkage model *) (*Summary: Example 1 in Baker, S.G. 1992. A simple method for computing the observed information matrix when using the EM algorithm with categorical data, Journal of Computational and Graphical Statistics. *) (*Keywords: genetics *) (*Requirements: "clm`" *) (*History: 1992 Stuart G. Baker *) Clear[exgen] y=Transpose[{{125,18,20,34}}]; mod1="None"; mod={mod1}; exgen[y_,modelname_]:= Module[{q1,w1,g1,h1,z1,x1, func1,x1a,x1b,arg1, nv,ncore,n,q,w,g,h,z,x, matrixspec,func,modelspec, rmata,rmatb,rmat, name,parametername,rationame, model,c}, (*model*) q1=Identity; w1=J[5,1,0]; g1=Id[5]; h1=Log[#1+#2]&; z1={{.5},{0},{.25},{.25},{0}}; x1={{0},{.25},{-.25},{-.25},{.25}}; func1=NPS; x1a=IndicatorMatrix[x1,.25]; x1b=Abs[x1/.25]; arg1={x1a,x1b}; (*combination*) ncore=J[1,4] . y; nv=ncore ~Dir~ J[5,1]; n={nv,ncore}; q={q1}; w={w1}; g={g1}; h={h1}; z={z1}; x={x1}; matrixspec={n,q,w,g,h,z,x}; func={func1}; modelspec={arg1}; model={matrixspec,func,modelspec}; c=BlockDiag[J[1,2],Id[3]]; ratio="None"; parametername={"theta"}; rationame=Automatic; name={parametername,rationame}; Return[{c,model,ratio,name}]]/; MemberQ[mod,modelname]