MX script for the common factor QTL model from Chapter 12 #Ngroups 3 ! number of groups in analysis #Define nvar 3 ! number of variables measured #Define ndef 3 ! number of definition variables #Define nsib 2 ! number of siblings G1: LINK ! group 1 Data calculation Begin matrices ; X lower nvar nvar free ! factor loadings for Va Y full nvar 1 free ! factor loadings for Vq Z lower nvar nvar free ! factor loadings for Ve M full 1 nvar free ! means of the sib1 and sib2 group for 3 variables. R full nvar ndef free ! Betas for age,sex and Lipid medication effects for sib1 and sib2 group for ! 3 variables. H full 1 1 fix ! 0.5 matrix End matrices ; Matrix H 0.5000; Begin algebra ; A = X*X'; ! this is Va Q = Y*Y'; ! this is Vq E = Z*Z'; ! this is Ve V = A%(A+E+Q) | Q%(A+E+Q) | E%(A+E+Q); ! the relative contribution of components Va, Vq and Ve End algebra ; Start 3.65 M 1 1 1 ! Input of starting values for the defined matrices Start 1.21 M 1 1 2 Start 10.5 M 1 1 3 Start 0.02 R 1 1 1 to R 1 3 3 Start 0.54 X 1 1 1 ! Starting values Va Start 0.18 X 1 2 2 Start 1.53 X 1 3 3 Start 0.10 X 1 2 1 Start 0.82 X 1 3 1 Start 0.34 X 1 3 2 Start 0.54 Y 1 1 1 ! Starting values Vq Start 0.18 Y 1 2 1 Start 1.53 Y 1 3 1 Start 0.54 Z 1 1 1 ! Starting values Ve Start 0.18 Z 1 2 2 Start 1.53 Z 1 3 3 Start 0.10 Z 1 2 1 Start 0.82 Z 1 3 1 Start 0.34 Z 1 3 2 End G2: MZs Data NI=17 Missing=-1.00000 Rectangular File = lipidmz.dat Labels fam zyg nihid1 sex1 age1 ldl1 apob1 lnapoe1 nihid2 sex2 age2 ldl2 apob2 lnapoe2 IBD0 IBD1 IBD2 Select sex1 age1 sex2 age2 ldl1 apob1 lnapoe1 ldl2 apob2 lnapoe2 IBD1 IBD2 ; Definition_variables sex1 age1 sex2 age2 IBD1 IBD2 ; Matrices = group 1 T full ndef nsib ! sex age and lipid meds for sib1-sib2 N full 1 1 ! IBD1 probability for sib1-sib2. O full 1 1 ! IBD2 probability.for sib1-sib2. End matrices ; Specify T sex1 sex2 ! defines variables sex. age1 age2 ! defines variables age 0 0 ; ! defines variables lipid medication, note that none of the MZ twins ! uses medication so the values are fixed at 0 in this group. Specify N IBD1; !defines IBD1 matrix. Specify O IBD2; !defines IBD2 matrix. Begin algebra ; P = H@N+O ; ! calculates p. NOTE that in the datafile IBD2 = 1 and IBD1 = 0 in all cases. End algebra ; Means (M|M)+(\vec(R*T))' !means model with linear regression of sex, age and lipid medication/ !xi: = µ + ß1 Agei + ß2 Sexi + ß3 LipMedi + ei Covariances A+E+Q | P@Q+A _ ! Variance - covariance structure for the MZ twins. P@Q+A | A+E+Q; End G3: DZs ! Group 3 input data DZ twins and covariance structure of ! this group Data NI=182 Missing=-1.00000 Rectangular File = lipiddz.dat Labels fam zyg nihid1 lipidme1 sex1 age1 ldl1 apob1 apoe1 lnapoe1 nihid2 lipidme2 sex2 age2 ldl2 apob2 apoe2 lnapoe2 pihat65 pi65cat -- ibd2m54 Select sex1 age1 lipidme1 sex2 age2 lipidme2 ldl1 apob1 lnapoe1 ldl2 apob2 lnapoe2 IBD1m1 IBD2m1; Definition ! This defines the covariate variables for the means model. sex1 age1 lipidme1 sex2 age2 lipidme2 IBD1m1 IBD2m1; Matrices = group 1 T full ndef nsib ! sex age and lipid meds for sib1-sib2 N full 1 1 ! IBD1 probability for sib1-sib2. O full 1 1 ! IBD2 probability.for sib1-sib2. End matrices ; Specify T sex1 sex2 ! defines variables sex. age1 age2 ! defines variables age lipidme1 lipidme2 ; ! defines variables lipid medication, Specify N IBD1m1; !defines IBD1 matrix in this case for location 1 replace with m2…m54 ! for the other locations. Specify O IBD2m1; !defines IBD2 matrix similar as matrix N. Begin algebra; P = H@N+O ; ! calculates . End algebra; Means (M|M)+(\vec(R*T))' !means model with linear regression of sex, age and lipid medication/ !xi: = µ + ß1 Agei + ß2 Sexi + ß3 LipMedi + ei Covariances A+E+Q | P@Q+H@A _ ! Variance - covariance structure for the DZ twins. P@Q+H@A | A+E+Q; ! P = pihat Option Ndecimals=4; Option MU issat; End DROP Q 1 1 1 Q 1 2 1 Q 1 3 1 Q 1 4 1; ! test for linkage. The Null model does not need to be tested for all ! positions, which saves some time on a genomic scan. End