MX script for a univariate GxE QTL model from Chapter 11 !GxE QTL model with two moderator variables #define nmod 3 ! unmod, yob, sex #define ndef 2 ! nmod -1 #define nsib 4 ! size of largest sibship #define sib 3 ! nsib-1 Data Calc NGroups=3 Begin Matrices ; A full 1 nmod free ! this matrix will hold estimates of: the unmoderated, YOB moderated and Sex ! moderated Additive genetic path coefficients C full 1 nmod free ! this matrix will hold estimates of: the unmoderated, YOB moderated and Sex ! moderated Common environmental path coefficients E full 1 nmod free ! this matrix will hold estimates of: the unmoderated, YOB moderated and Sex ! moderated Unique environmental path coefficients Q full 1 nmod free ! this matrix will hold estimates of: the unmoderated, YOB moderated and Sex ! moderated QTL path coefficients M full 1 1 free ! mean B full 1 ndef free ! mean effects H Stand nsib nsib ! mz constants J Stand nsib nsib ! dz constants U unit nsib 1 D diag nsib nsib End Matrices ; Value 1 H 2 1 Value .5 H 3 1 to H sib sib Value .5 H 2 1 to H sib sib Start 0 M 1 1 Start 1 d 1 1 d 2 2 d 3 3 d 4 4 Labels column A unmod yob sex Labels column C unmod yob sex Labels column E unmod yob sex Labels column B yob sq bw sex Options RSiduals End G2: MZ Data group Data NInput=17 Rectangular File=mz.dat labels phenotype1 phenotype2 phenotype3 phenotype4 yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 pab pac pbc pad pbd pcd Select phenotype1 phenotype2 phenotype3 phenotype4 yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 pab pac pbc pad pbd pcd; Definition_variables yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 pab pac pbc pad pbd pcd; Matrices =Group 1 V full nmod nsib ! covariates for variance effects W full ndef nsib ! covariates for mean effects P stand nsib nsib ! to contain pihats End Matrices ; !place yob in the 2nd row of the v matrix and sex in the 3rd !the 1st row contains 1s for the unmoderated variance components !this matrix will be * multiplied to produce variance components that include !the GxE effects Specify V 0 0 0 0 yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 Value 1 V 1 1 V 1 2 v 1 3 v 1 4 !place yob in the 1st row of the w matrix and sex in the 2nd Specify W yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 !place the pihats in the P matrix in the correct order Specify P pab pac pbc pad pbd pcd; Means (U@M) + (B*W) ; Covariance (H.((U@A)*V).(V'*(U@A)'))+ !additve genetic effects ((U@C)*V).(V'*(U@C)')+ !common environmental effects (P.((U@Q)*V).(V'*(U@Q)'))+ !qtl effects (D.((U@E)*V).(V'*(U@E)')) ; !unique environmental effects End G3: DZ Data NInput=17 Rectangular File=mz.dat Labels phenotype1 phenotype2 phenotype3 phenotype4 yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 pab pac pbc pad pbd pcd Select phenotype1 phenotype2 phenotype3 phenotype4 yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 pab pac pbc pad pbd pcd; Definition_variables yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 pab pac pbc pad pbd pcd; Matrices =Group 1 V full nmod nsib ! covariates for variance effects W full ndef nsib ! covariates for mean effects P stand nsib nsib ! to contain pihats End Matrices ; !place yob in the 2nd row of the v matrix and sex in the 3rd !the 1st row contains 1s for the unmoderated variance components Specify V 0 0 0 0 yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 Value 1 V 1 1 V 1 2 v 1 3 v 1 4 !place yob in the 1st row of the w matrix and sex in the 2nd Specify W yob1 yob2 yob3 yob4 sex1 sex2 sex3 sex4 Specify P pab pac pbc pad pbd pcd; Means (U@M) + (B*W) ; Covariance (J.((U@A)*V).(V'*(U@A)'))+ !additve genetic effects ((U@C)*V).(V'*(U@C)')+ !common environmental effects (P.((U@Q)*V).(V'*(U@Q)'))+ !qtl effects (D.((U@E)*V).(V'*(U@E)')) ; !unique environmental effects Option multiple End save temp.mxs !test the QTLxSex effect Drop Q 1 1 3 End get temp.mxs !test the QTLxYOB effect Drop Q 1 1 2 End !test both the QTLxSex and QTLxYOB effects Drop Q 1 1 3 End !test the unmoderated QTL effect Drop Q 1 1 1 End