(*:Mathematica:: V2.1 *) (*:Context: "exordc`" *) (*Title:: ordered categorical data- continuation ratio model *) (*References:: McCullugh, P. and Nelder, J.A. 1989 (Second edition). Generalized Linear Models, London: Chapman and Hall pages 178-182 *) (*Keywords:: ordered categorical data *) (*Requirements:: "clmmat`" *) (*History:: 1992 Stuart G. Baker *) Clear[exordc]; y=Transpose[{{98,0,0, 51,2,1, 34,6,3, 35,5,8, 32,10,9, 23,7,8, 12,6,10, 4,2,5}}]; mod1="None"; mod={mod1}; exordc[y_,modelname_]:= Module[{q1,w1,g1,h1,z1,x1, gt,age,x1cat,x1age, x1a,m1t,m1,arg1, nv,ncore,n,q,w,g,h,z,x, components,mstepfunc,msteparg, parametername,rationame, c,model,ratio,name}, (*model*) q1=Identity; w1=J[24,1,0]; gt={{1,0,0,0},{0,1,1,0},{0,1,0,1}}; g1=Id[8] ~Dir~ gt; h1=#1 #2 - Log[1+Exp[#2]]&; z1=J[16,1] ~Dir~ {{1},{0}}; age=Transpose[{{5.8,15.0,21.5,27.5,33.5,39.5,46.0,51.5}}]; x1cat=Dir[J[8,1],Id[2]]; x1age=-Log[age] ~Dir~ J[2,1]; x1a=x1cat ~Hcat~ x1age; x1=x1a ~Dir~ J[2,1]; func1=NLR; m1t=Transpose[gt]; m1=Id[8] ~Dir~ m1t; arg1={m1,x1a}; (*combination*) ncore=Dir[Id[8],J[1,3]].y; nv=ncore ~Dir~ J[3,1]; n={nv,ncore}; q={q1}; w={w1}; g={g1}; h={h1}; z={z1}; x={x1}; c=Id[24]; components={n,q,w,g,h,z,x}; mstepfunc={func1}; msteparg={arg1}; model={components,mstepfunc,msteparg}; ratio="None"; parametername={"alpha1","alpha2","beta"}; rationame=Automatic; name={parametername,rationame}; Return[{c,model,ratio,name}]]/;MemberQ[mod,modelname]