! univariate3x3.mx ! fitting a univariate genetic model to 3x3 data #define nvar 1 #define maxthresf 2 ! number of thresholds Analysis of depression data: estimating tetrachorics & confidence intervals data NI=3 NO=9 NG=3 LAbels twina twinb countmz Ordinal fi=smkmzf.rec ! Count is a definition variable that we use to tell MX the frequency count ! for each element of the 3x3 table ! Definition_variables countmz / Begin matrices; W LO nvar nvar fr ! additive genetic path (A=w*w') X LO nvar nvar fr ! shared environmental path (C=x*x') Y LO nvar nvar fr ! non-shared environmental path (E=y*y') Z LO nvar nvar fi ! non-additive genetic path (D=z*z') M FU maxthresf nvar fi ! matrix of thresholds L LO maxthresf maxthresf ! used to ensure t1 < t2 S DI nvar nvar ! Matrix that will store weight variable end matrices; SP M 4 5 MATRIX M 1.5487 0.5 MATRIX L 1 1 1 ! This tells MX to store the definition variable count in S SP S -1 mat w 0.5 mat x 0.5 mat y 0.7 Begin algebra; A=W*W'; C=X*X'; E=Y*Y'; D=Z*Z'; V=A+C+D+E; T=L*M; end algebra; FREQ S; ! tells MX that S contains the weight (frequency) variable TH T|T; ! tells MX that row and column thresholds contained in T|T CO V|A+D+C_ A'+D'+C'|V; ! formula for correlation matrix! bo 0.001 1.0 y(1,1) m(2,1) bo 0.0001 0.999 w(1,1) x(1,1) bo -5.0 5.0 m(1,1) interval a(1,1) c(1,1) e(1,1) ! compute 95% confidence interval for correlation OPT func=1.E-12 OPT RS END Analysis of ordinal alcohol tolerance and dependence data: DZm data NI=3 NO=9 LAbels twina twinb countdz OR fi=smkdzf.rec Definition_variables countdz / Begin matrices = group 1; S DI nvar nvar ! Matrix that will store weight variable g DI 1 1 ! constant (=0.5) for coefficient of additive genetic component h DI 1 1 ! constant (=0.25) for coefficient of dominance genetic component n FU maxthresf nvar fi ! matrix of thresholds end matrices; SP N 6 7 MATRIX N 1.4487 0.5 MAT g 0.5 MAT h 0.25 SP S -1 Begin algebra; T=L*N; end algebra; FREQ S; TH T|T; CO V|g@A+h@D+C_ g@A'+h@D'+C'|V; ! formula for correlation matrix! bo -5.0 5.0 n(1,1) bo 0.001 1.0 n(2,1) OPT RS END Constraint function - constrain variances to unity CO NI=1 Begin matrices = group 1; U unit 1 nvar end matrices; CO \d2v(V) = u; end