! SCRIPT NAME : lingrow.mx (jh) ! GOAL : To evaluate bivariate linear growth curve model for heritability estimation of latent variables: intercept and slope ! DATA : continuous ! INPUT : raw data ! UNI/BI/MULTI : uni (longitudinal observations) ! DATA-GROUPS : MZ, DZ-SS ! MEANS MODEL : grand mean, sex effect ! VARIANCE COVARIANCE MODEL(S) : 1.ACE , 2.ACE orthogonal, 3. AE, 4. ADE ! Downloading Mx software: ! Mx script's library: ! GenomEUtwin lingrow.mx ! ! Script for the analysis of (simulated) univariate ! continuous longitudinal twin data in wave representation. ! ! Model: Linear growthcurve model. ! Biometric model (ACE) for slopes and intercepts. The following MX script lines were read for group 1 #DEFINE NT 4 #DEFINE NTX2 8 ! TWICE THE NUMBER OG TIMEPOINTS. #DEFINE NF 2 ! NUMBER OF FACTORS. #DEFINE NFX2 4 ! TWICE THE NUMBER OF FACTORS. #DEFINE NINPUT 11 ! NUMBER OF INPUT VARIABLES (4 VARIABLES FOR EACH TWIN, PLUS FAMILY ID, SEX, ZYGOSITY). GROUP #1 INITIALIZATION CALCULATION NG=3 BEGIN MATRICES; F FULL NT 2 FIXED ! MATRIX OF FACTOR LOADINGS X LOWER 2 2 FREE ! CHOLESKY FACTOR FOR GENETIC (CO)VARIANCE Y LOWER 2 2 FREE ! CHOLESKY FACTOR FOR VARIANCE DUE TO SHARED COVARIANCE Z LOWER 2 2 FREE ! CHOLESKY FACTOR FOR VARIANCE DUE TO NON-SHARED ENVIRONMENT V LOWER 2 2 FIXED ! CHOLESKY FACTOR FOR GENETIC DOMINANT (CO)VARIANCE L FULL 1 1 FREE ! CHOLESKY FACTOR FOR RESIDUAL VARIANCE. B IDEN NT NT FIXED ! IDENTITY MATRIX J IDEN NF NF FIXED ! IDENTITY MATRIX W ZERO NT NT FIXED ! ZERO MATRIX H FULL 1 1 FIXED ! SCALAR = 1/2 I FULL 1 1 FIXED ! SCALAR = 1/4 Q FULL 2 1 FREE ! MEAN INTERCEPT & SLOPE N FULL 1 NT FIXED ! EFFECT OF COVARIATE END MATRICES; MATRIX H .5 MATRIX I .25 MATRIX F 1 0 1 1 1 2 1 3 START -0.5 ALL ST 0.2766 X(1,1) ST -0.0033 X(2,1) ST -0.0014 X(2,2) ST 0.27152 Y(1,1) ST -0.0032231 Y(2,1) ST -0.000000007 Y(2,2) ST 0.4301 Z(1,1) ST -0.0052 Z(2,1) ST 0.0011 Z(2,2) START 3.4923 Q(1,1) START -0.0028 Q(2,1) START 0.0582 L(1,1) BOUND -100 100 ALL !START 0.05 X(1,1) X(2,2) Y(1,1) Y(2,2) Z(1,1) Z(2,2) !START 0.05 X(2,1) Y(2,1) Z(2,1) BEGIN ALGEBRA; A = X*X'; C = Y*Y'; E = Z*Z'; D = V*V'; K =((J.(A + D + C + E))~*A)|((J.(A + D + C + E))~*C)|((J.(A + D + C + E))~*E); ! SCALED COVARIANCE MATRIX M = A+D+C+E | A+D+C _ A+D+C | A+D+C+E; ! COVARIANCE MATRIX OF INTERCEPT AND SLOPE FOR MZ PAIR S = A+D+C+E | H@A+I@D+C _ H@A+I@D+C | A+D+C+E; ! COVARIANCE MATRIX OF INTERCEPT AND SLOPE FOR DZ PAIR G = (L*L')@B | W _ W | (L*L')@B; ! MATRIX OF RESIDUAL VARIANCE P = \STND(A) | \STND(E); END ALGEBRA; !INTERVAL ! K(1,1,1) K(1,2,2) K(1,1,3) K(1,2,4) K(1,1,5) K(1,2,6) !INTERVAL ! Q(1,1,1) Q(1,2,1) !INTERVAL ! N(1,1,1) N(1,1,2) N(1,1,3) N(1,1,4) !INTERVAL ! P(1,2,1) P(1,2,3) END The following MX script lines were read for group 2 GROUP #2 MZ TWINS DATA NI=NINPUT ! NUMBER OF INPUTVARIABLES RECTANGULAR FILE=EXAMPLE4.DAT ! INPUT FILE CONTAINING RAW DATA Rectangular continuous data read initiated NOTE: Rectangular file contained 1000 records with data that contained a total of 11000 observations LABELS PAIRID SEX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 WAVE23 WAVE24 ZYGOS SELECT IF ZYGOS = 1 ; ! MZ'S ONLY FOR THIS GROUP NOTE: Select if yields 400 data vectors for analysis NOTE: Vectors contain a total of 4400 observations SELECT SEX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 WAVE23 WAVE24 ; DEFINITION SEX; NOTE: Selection yields 400 data vectors for analysis NOTE: Vectors contain a total of 3600 observations BEGIN MATRICES; NOTE: Definition yields 400 data vectors for analysis NOTE: Vectors contain a total of 3200 observations Note: definition makes highest ordinal variable category 1 F FULL NT NF =F1 M COMPUTED =M1 G COMPUTED =G1 Q FULL 2 1 =Q1 N FULL 1 NT =N1 ! EFFECT OF COVARIATE, FEMALE K FULL 1 1 I IDEN 2 2 U UNIT 1 2 END MATRICES; SPECIFY K -1 MEANS (F*Q)' + K*N | (F*Q)'+ K*N ; COVARIANCE (I@F)&M + G ; OPTIONS RS END The following MX script lines were read for group 3 GROUP #3 DZ TWINS DATA NI=NINPUT RECTANGULAR FILE=EXAMPLE4.DAT Rectangular continuous data read initiated NOTE: Rectangular file contained 1000 records with data that contained a total of 11000 observations LABELS PAIRID SEX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 WAVE23 WAVE24 ZYGOS SELECT IF ZYGOS = 2 ; ! DZ'S ONLY FOR THIS GROUP NOTE: Select if yields 600 data vectors for analysis NOTE: Vectors contain a total of 6600 observations SELECT SEX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 WAVE23 WAVE24 ; DEFINITION SEX; NOTE: Selection yields 600 data vectors for analysis NOTE: Vectors contain a total of 5400 observations Note: Global variable previously defined. Updating SEX BEGIN MATRICES; NOTE: Definition yields 600 data vectors for analysis NOTE: Vectors contain a total of 4800 observations Note: definition makes highest ordinal variable category 1 F FULL NT 2 =F1 D COMPUTED =S1 Q FULL 2 1 =Q1 G COMPUTED =G1 N FULL 1 NT =N1 ! EFFECT OF COVARIATE, FEMALE K FULL 1 1 H FULL 1 1 =H1 I IDEN 2 2 U UNIT 1 2 END MATRICES; SPECIFY K -1 MEANS (F*Q)' + K*N | (F*Q)'+ K*N ; COVARIANCE (I@F)&D + G ; !Option TH=-2 OPTION JIGGLE !Option it=5000 OPTIONS MULTIPLE ISSAT END Summary of VL file data for group 2 SEX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 Code -1.0000 1.0000 2.0000 3.0000 4.0000 5.0000 Number 400.0000 400.0000 400.0000 400.0000 400.0000 400.0000 Mean 1.5000 3.5410 3.5206 3.4841 3.4536 3.5085 Variance 0.2500 0.3351 0.2892 0.2416 0.1916 0.3544 Minimum 1.0000 1.9443 1.9553 2.0887 2.2714 1.7027 Maximum 2.0000 4.9934 4.9001 4.6441 4.5371 5.0382 WAVE22 WAVE23 WAVE24 Code 6.0000 7.0000 8.0000 Number 400.0000 400.0000 400.0000 Mean 3.4818 3.4583 3.4287 Variance 0.3084 0.2532 0.2136 Minimum 1.7682 1.8873 2.0761 Maximum 4.8847 4.7031 4.6320 Summary of VL file data for group 3 SEX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 Code -1.0000 1.0000 2.0000 3.0000 4.0000 5.0000 Number 600.0000 600.0000 600.0000 600.0000 600.0000 600.0000 Mean 1.5000 3.4946 3.4713 3.4438 3.4187 3.5347 Variance 0.2500 0.3205 0.2704 0.2278 0.1886 0.3174 Minimum 1.0000 1.7020 1.7375 1.8454 2.1050 1.5106 Maximum 2.0000 4.9269 4.7989 4.6543 4.5757 5.8465 WAVE22 WAVE23 WAVE24 Code 6.0000 7.0000 8.0000 Number 600.0000 600.0000 600.0000 Mean 3.5081 3.4815 3.4494 Variance 0.2685 0.2253 0.1849 Minimum 1.5503 1.7765 1.8446 Maximum 5.5083 5.2476 5.0668 PARAMETER SPECIFICATIONS GROUP NUMBER: 1 GROUP #1 Initialization MATRIX A This is a computed FULL matrix of order 2 by 2 It has no free parameters specified MATRIX B This is an IDENTITY matrix of order 4 by 4 MATRIX C This is a computed FULL matrix of order 2 by 2 It has no free parameters specified MATRIX D This is a computed FULL matrix of order 2 by 2 It has no free parameters specified MATRIX E This is a computed FULL matrix of order 2 by 2 It has no free parameters specified MATRIX F This is a FULL matrix of order 4 by 2 It has no free parameters specified MATRIX G This is a computed FULL matrix of order 8 by 8 It has no free parameters specified MATRIX H This is a FULL matrix of order 1 by 1 It has no free parameters specified MATRIX I This is a FULL matrix of order 1 by 1 It has no free parameters specified MATRIX J This is an IDENTITY matrix of order 2 by 2 MATRIX K This is a computed FULL matrix of order 2 by 6 It has no free parameters specified MATRIX L This is a FULL matrix of order 1 by 1 1 1 10 MATRIX M This is a computed FULL matrix of order 4 by 4 It has no free parameters specified MATRIX N This is a FULL matrix of order 1 by 4 It has no free parameters specified MATRIX P This is a computed FULL matrix of order 2 by 4 It has no free parameters specified MATRIX Q This is a FULL matrix of order 2 by 1 1 1 11 2 12 MATRIX S This is a computed FULL matrix of order 4 by 4 It has no free parameters specified MATRIX V This is a LOWER TRIANGULAR matrix of order 2 by 2 It has no free parameters specified MATRIX W This is a NULL matrix of order 4 by 4 MATRIX X This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 1 2 2 3 MATRIX Y This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 4 2 5 6 MATRIX Z This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 7 2 8 9 GROUP NUMBER: 2 GROUP #2 Mz twins MATRIX F This is a FULL matrix of order 4 by 2 It has no free parameters specified MATRIX G This is a computed FULL matrix of order 8 by 8 It has no free parameters specified MATRIX I This is an IDENTITY matrix of order 2 by 2 MATRIX K This is a FULL matrix of order 1 by 1 1 1 -1 MATRIX M This is a computed FULL matrix of order 4 by 4 It has no free parameters specified MATRIX N This is a FULL matrix of order 1 by 4 It has no free parameters specified MATRIX Q This is a FULL matrix of order 2 by 1 1 1 11 2 12 MATRIX U This is a UNIT matrix of order 1 by 2 GROUP NUMBER: 3 GROUP #3 Dz twins MATRIX D This is a computed FULL matrix of order 4 by 4 It has no free parameters specified MATRIX F This is a FULL matrix of order 4 by 2 It has no free parameters specified MATRIX G This is a computed FULL matrix of order 8 by 8 It has no free parameters specified MATRIX H This is a FULL matrix of order 1 by 1 It has no free parameters specified MATRIX I This is an IDENTITY matrix of order 2 by 2 MATRIX K This is a FULL matrix of order 1 by 1 1 1 -1 MATRIX N This is a FULL matrix of order 1 by 4 It has no free parameters specified MATRIX Q This is a FULL matrix of order 2 by 1 1 1 11 2 12 MATRIX U This is a UNIT matrix of order 1 by 2 Jiggling parameter estimates... Mx starting optimization; number of parameters = 12 MX PARAMETER ESTIMATES GROUP NUMBER: 1 GROUP #1 Initialization MATRIX A This is a computed FULL matrix of order 2 by 2 [=X*X'] 1 2 1 1.2904E-01 -1.0142E-02 2 -1.0142E-02 8.9630E-04 MATRIX B This is an IDENTITY matrix of order 4 by 4 MATRIX C This is a computed FULL matrix of order 2 by 2 [=Y*Y'] 1 2 1 3.6646E-02 -2.8222E-03 2 -2.8222E-03 2.1734E-04 MATRIX D This is a computed FULL matrix of order 2 by 2 [=V*V'] 1 2 1 0.0000 0.0000 2 0.0000 0.0000 MATRIX E This is a computed FULL matrix of order 2 by 2 [=Z*Z'] 1 2 1 0.1607 -0.0131 2 -0.0131 0.0011 MATRIX F This is a FULL matrix of order 4 by 2 1 2 1 1.0000 0.0000 2 1.0000 1.0000 3 1.0000 2.0000 4 1.0000 3.0000 MATRIX G This is a computed FULL matrix of order 8 by 8 [=(L*L')@B|W_W|(L*L')@B] 1 2 3 4 5 6 7 8 1 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 4 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 5 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 6 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 7 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 8 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 MATRIX H This is a FULL matrix of order 1 by 1 1 1 0.5000 MATRIX I This is a FULL matrix of order 1 by 1 1 1 0.2500 MATRIX J This is an IDENTITY matrix of order 2 by 2 MATRIX K This is a computed FULL matrix of order 2 by 6 [=((J.(A+D+C+E))~*A)|((J.(A+D+C+E))~*C)|((J.(A+D+C+E))~*E)] 1 2 3 4 5 6 1 0.3954 -0.0311 0.1123 -0.0086 0.4924 -0.0403 2 -4.5071 0.3983 -1.2542 0.0966 -5.8430 0.5051 MATRIX L This is a FULL matrix of order 1 by 1 1 1 0.0572 MATRIX M This is a computed FULL matrix of order 4 by 4 [=A+D+C+E|A+D+C_A+D+C|A+D+C+E] 1 2 3 4 1 0.3264 -0.0261 0.1657 -0.0130 2 -0.0261 0.0023 -0.0130 0.0011 3 0.1657 -0.0130 0.3264 -0.0261 4 -0.0130 0.0011 -0.0261 0.0023 MATRIX N This is a FULL matrix of order 1 by 4 1 2 3 4 1 0.0000 0.0000 0.0000 0.0000 MATRIX P This is a computed FULL matrix of order 2 by 4 [=\STND(A)|\STND(E)] 1 2 3 4 1 1.0000 -0.9431 1.0000 -0.9729 2 -0.9431 1.0000 -0.9729 1.0000 MATRIX Q This is a FULL matrix of order 2 by 1 1 1 3.5197 2 -0.0273 MATRIX S This is a computed FULL matrix of order 4 by 4 [=A+D+C+E|H@A+I@D+C_H@A+I@D+C|A+D+C+E] 1 2 3 4 1 3.2637E-01 -2.6113E-02 1.0116E-01 -7.8933E-03 2 -2.6113E-02 2.2502E-03 -7.8933E-03 6.6549E-04 3 1.0116E-01 -7.8933E-03 3.2637E-01 -2.6113E-02 4 -7.8933E-03 6.6549E-04 -2.6113E-02 2.2502E-03 MATRIX V This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 0.0000 2 0.0000 0.0000 MATRIX W This is a NULL matrix of order 4 by 4 MATRIX X This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 0.3592 2 -0.0282 0.0100 MATRIX Y This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 1.9143E-01 2 -1.4743E-02 1.1813E-09 MATRIX Z This is a LOWER TRIANGULAR matrix of order 2 by 2 1 2 1 0.4009 2 -0.0328 0.0078 GROUP NUMBER: 2 GROUP #2 Mz twins MATRIX F This is a FULL matrix of order 4 by 2 1 2 1 1.0000 0.0000 2 1.0000 1.0000 3 1.0000 2.0000 4 1.0000 3.0000 MATRIX G This is a computed FULL matrix of order 8 by 8 [=(L*L')@B|W_W|(L*L')@B] 1 2 3 4 5 6 7 8 1 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 4 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 5 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 6 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 7 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 8 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 MATRIX I This is an IDENTITY matrix of order 2 by 2 MATRIX K This is a FULL matrix of order 1 by 1 1 1 2.0000 MATRIX M This is a computed FULL matrix of order 4 by 4 [=A+D+C+E|A+D+C_A+D+C|A+D+C+E] 1 2 3 4 1 0.3264 -0.0261 0.1657 -0.0130 2 -0.0261 0.0023 -0.0130 0.0011 3 0.1657 -0.0130 0.3264 -0.0261 4 -0.0130 0.0011 -0.0261 0.0023 MATRIX N This is a FULL matrix of order 1 by 4 1 2 3 4 1 0.0000 0.0000 0.0000 0.0000 MATRIX Q This is a FULL matrix of order 2 by 1 1 1 3.5197 2 -0.0273 MATRIX U This is a UNIT matrix of order 1 by 2 Vector of OBSERVED means WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 Mean 3.5410 3.5206 3.4841 3.4536 3.5085 3.4818 WAVE23 WAVE24 Mean 3.4583 3.4287 Vector of EXPECTED means WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 Mean 3.5197 3.4924 3.4650 3.4377 3.5197 3.4924 WAVE23 WAVE24 Mean 3.4650 3.4377 (OBSERVED MATRIX is nonexistent for raw data) EXPECTED COVARIANCE MATRIX WAVE11 WAVE12 WAVE13 WAVE14 WAVE21 WAVE22 WAVE23 WAVE24 WAVE11 0.3296 WAVE12 0.3003 0.2797 WAVE13 0.2741 0.2525 0.2342 WAVE14 0.2480 0.2287 0.2093 0.1932 WAVE21 0.1657 0.1527 0.1398 0.1268 0.3296 WAVE22 0.1527 0.1409 0.1290 0.1172 0.3003 0.2797 WAVE23 0.1398 0.1290 0.1183 0.1075 0.2741 0.2525 0.2342 WAVE24 0.1268 0.1172 0.1075 0.0979 0.2480 0.2287 0.2093 0.1932 Function value of this group: -4394.2629 Where the fit function is -2 * Log-likelihood of raw data GROUP NUMBER: 3 GROUP #3 Dz twins MATRIX D This is a computed FULL matrix of order 4 by 4 [=A+D+C+E|H@A+I@D+C_H@A+I@D+C|A+D+C+E] 1 2 3 4 1 3.2637E-01 -2.6113E-02 1.0116E-01 -7.8933E-03 2 -2.6113E-02 2.2502E-03 -7.8933E-03 6.6549E-04 3 1.0116E-01 -7.8933E-03 3.2637E-01 -2.6113E-02 4 -7.8933E-03 6.6549E-04 -2.6113E-02 2.2502E-03 MATRIX F This is a FULL matrix of order 4 by 2 1 2 1 1.0000 0.0000 2 1.0000 1.0000 3 1.0000 2.0000 4 1.0000 3.0000 MATRIX G This is a computed FULL matrix of order 8 by 8 [=(L*L')@B|W_W|(L*L')@B] 1 2 3 4 5 6 7 8 1 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 2 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 0.0000 4 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 0.0000 5 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 0.0000 6 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 0.0000 7 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 0.0000 8 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0033 MATRIX H This is a FULL matrix of order 1 by 1 1 1 0.5000 MATRIX I This is an IDENTITY matrix of order 2 by 2 MATRIX K This is a FULL matrix of order 1 by 1 1 1 2.0000 MATRIX N This is a FULL matrix of order 1 by 4 1 2 3 4 1 0.0000 0.0000 0.0000 0.0000 MATRIX Q This is a FULL matrix of order 2 by 1 1 1 3.5197 2 -0.0273 MATRIX U This is a UNIT matrix of order 1 by 2 Your model has 12 estimated parameters and 8000 Observed statistics -2 times log-likelihood of data >>>-11226.578 Degrees of freedom >>>>>>>>>>>>>>>> 7988 This problem used 26.3% of my workspace Task Time elapsed (DD:HH:MM:SS) Reading script & data 0: 0: 0: 6.75 Execution 0: 0: 0: 4.06 TOTAL 0: 0: 0:10.81 Total number of warnings issued: 0 ______________________________________________________________________________ !SAVE lingrow.mxs ! FIT submodels !GET lingrow.mxs !DROP @0 (certain pathways) !END