# EXPLANATION OF THE MODEL #---------------------------------------------------------------- # Basic model matrix algebra #---------------------------------------------------------------- # Covariance ALGEBRA: #---------------------------------------------------------------- # SigmaMZ = Lambda %*% solve(I-Beta) %*% PsyMZ %*% t(solve(I-Beta)) %*% t(Lambda) + ThetaMZ # SigmaDZ = Lambda %*% solve(I-Beta) %*% PsyDZ %*% t(solve(I-Beta)) %*% t(Lambda) + ThetaDZ #---------------------------------------------------------------- # For a good reference to this type of model specification used in SEM see Bollen 1989. # This is the basic matrix algebra used in Structural Equation Modeling, in which we use # the matrices Lambda, Psy, Beta and Theta plus an Identity matrix to compute the expected covariance matrix Sigma # So to specify the model in terms of the matrix algebra, we need to specify the content of these four matrices. # What is inside each of these matrices #---------------------------------------------------------------- # - Lambda - # is the matrix with the factors loading. #---------------------------------------------------------------- # - Psy - # is the matrix with variances of the components P, A, E, and C. # Based on what we know about MZ and DZ similiarity, we will see that these matrices differ #---------------------------------------------------------------- # - Beta - # is the matrix with the regressions between the components P, A, E, and C. #---------------------------------------------------------------- # - Theta - # is the matrix with the error variance. This can be decomposed into error due to a, c, and e. #---------------------------------------------------------------- #---------------------------------------------------------------- # MATRIX STRUCTURE #---------------------------------------------------------------- # To give you insight in the structure of the different matrices, here an overview of the different matrices # We are specifying a model for 4 timepoints, in which we start with the traditional decomposition of ACE. # We do this so that we can use our general script for both fitting the basic ACE simplex as well as the AE* GE cov simplex # As we use four time points, we will see that many of the big matrices can be thought of as a collection of sub matrices # Each of these sub matrices is 4 x 4. Depending on when we use it, it will have a different content # SUB MATRIX # 1 2 3 4 #-------- # ? ? ? ? # 1 # ? ? ? ? # 2 # ? ? ? ? # 3 # ? ? ? ? # 4 #-------- # 1 2 3 4 # These sub matrices are first shown in terms of one symbol, there after I will unfold these matrices, # so you can see what is actually inside them # NOTE: when using more timepoints, the matrices increase in dimensions # WITHIN TWIN vs BETWEEN TWIN # As we will see, many of the matrices can be thought of matrices that specify the paths WITHIN twin and BETWEEN twin # I will come back to this ################################################################### # BEAM observed phenotype into PSY ################################################################### # We conceptualized GE covariance in terms of Ph->E transmission. # To ease the specification of this pathway,we use a little trick: # We 'beam' the observed phenotypic variance into the matrix Psy. # REMEMBER: the number of variables in PSY therefore became 4 x P, 4 x A, 4 X E, 4 X C = 32 ########################################################################## #---------------------------------------------------------------- # LAMBDA MATRIX (factor loading matrix) #---------------------------------------------------------------- ########################################################################## # To be able to beam the phenotype into PSY, we need to specify the LAMBDA matrix # such that we can specify the factor loadings on P A E and C. # As we only want to beam the variance of our observed phenotype into PSY, # we only allow factorloadings in the position of the P sub matrix in lambda # Dimensions of lambda #---------------------- # number of rows: 2 twins x 4 timepoint = 8 # number of columns 2 twins x 4 timepoints x 4 variables (P,A,E,C) at each timepoint = 32 # SUBMATRICES # I = 4 x 4 identity matrix # 0 = 4 x 4 zero matrix ########################################################################## #---------------------------------------------------------------- # LAMBDA MATRIX (factor loading matrix) #---------------------------------------------------------------- ########################################################################## # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 position #---------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # y1 I 0 0 0 0 0 0 0 1-4 # y2 0 0 0 0 I 0 0 0 5-8 #---------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 position ########################################################################## # So if we would unfold the matrix matrix, how would it look? #------------------------------------------------------------------------- # twin 1 twin 2 #------------------------------------------------------------------------- # P A E C P A E C # variance component # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 # time point #------------------------------------------------------------------------- # Within twin 1 between twins # 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 1, twin 1 # 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 2, twin 1 # 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 3, twin 1 # 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 4, twin 1 # between twins within twin 2 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 1, twin 2 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 2, twin 2 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 # time point 3, twin 2 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 # time point 4, twin 2 #------------------------------------------------------------------------- # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 # time point # P A E C P A E C # variance component #------------------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 # position # So now we specifie LAMBDA such that it beams P into the psy matrix ########################################################################## #---------------------------------------------------------------- # PSY MATRIX #---------------------------------------------------------------- ########################################################################## #------------- # CONTENT OF THE PSY MATRIX #------------- # we specify the variance WITHIN twins and the covariance BETWEEN twins. # we need to specify the structure for the Phenotype, Additive genetic, unique Environment and Common environment #------------- # WITHIN TWIN MATRICES: Variance components #------------- # Submatrices # [1] place for PHENOTYPIC VARIANCE: We used the LAMBDA matrix to lift the phenotypic variance into the PSY matrix. # [2] psA: ADDITIVE GENETIC VARIANCE: To estimate the additive genetic variance we specify a diagonal matrix psA # As previously, we assume that these estimates are equal between twins. # [3] psE: UNIQUE ENVIRONMENT: To estimate the unique environment, we specify a diagonal matrix psE. # We assume these differ among twins, as each twin has his unique environment # # [4] psC: COMMON ENVIRONMENT: To estimate the common environment, we specify a diagnoal matrix psC # We assume these are equal over twins, as it is the same variance that influences both twins #------------- # BETWEEN TWIN MATRICES: Covariance between twins #------------- # as previously explained, the resemblance between MZ and DZ twins is influenced by # [1] PsA* Additive genetic covariance # The additive genetic covariance is assumed to be 1 or .5 given zygocity. # Therefore PsA* is either 1*psA or .5*psA # [2] PsC: common environment. # THe common variance is assumed to be correlated 1, despite zygocity. # [3] PsE* special way to allow common environment # we can also specify the common variance in a different way: via allowing covariance in E : PsE* # # NOTE: PSY is symmetric, therefore it is not necessary to specify the between twin matrix twice. #------------- # STRUCTURE OF PSY #------------- #---------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 position #---------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # within twin 1 #P 0 1-4 #A 0 psA 5-8 #E 0 0 psE 9-12 #C 0 0 0 psC 13-16 # between twins # within twin 2 #P 0 0 0 0 0 17-20 #A 0 *psA 0 0 0 PsA 21-24 #E 0 0 *PsE 0 0 0 PsE 25-28 #C 0 0 0 PsC 0 0 0 PsC 29-32 # if using PsC than *PsE should be zero and vice versa! #---------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 position #---------------------------------------------------------------- # Again we could unfold this matrix, how would it look like? #------------------------------------------------------------------------- # twin 1 twin 2 #------------------------------------------------------------------------- # P A E C P A E C # variance component # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 # time point #------------------------------------------------------------------------- # Within twin 1 #0 #0 0 #0 0 0 #0 0 0 0 #------- #0 0 0 0 varA1 #0 0 0 0 0 varA2 #0 0 0 0 0 0 varA3 #0 0 0 0 0 0 0 varA4 #------- ------- - #0 0 0 0 0 0 0 0 varE1 #0 0 0 0 0 0 0 0 0 varE2 #0 0 0 0 0 0 0 0 0 0 varE3 #0 0 0 0 0 0 0 0 0 0 0 varE4 #------- ------- ------ - #0 0 0 0 0 0 0 0 0 0 0 0 varC1 #0 0 0 0 0 0 0 0 0 0 0 0 0 varC2 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 varC3 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varC4 # between twins # Within twin 2 #------- ------- ------ ------- - #0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #------- ------- ------ ------- ------- - #0 0 0 0 covA1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varA1 #0 0 0 0 0 covA2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varA2 #0 0 0 0 0 0 covA3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varA3 #0 0 0 0 0 0 0 covA4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varA4 #------- ------- ------ ------- ------- ------- - #0 0 0 0 0 0 0 0 * 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varE1 #0 0 0 0 0 0 0 0 0 * 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varE2 #0 0 0 0 0 0 0 0 0 0 * 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varE3 #0 0 0 0 0 0 0 0 0 0 0 * 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varE4 #------- ------- ------ ------- ------- ------- ------- - #0 0 0 0 0 0 0 0 0 0 0 0 covC 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 varC1 #0 0 0 0 0 0 0 0 0 0 0 0 0 covC 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 varC2 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 covC 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 varC3 #0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 covC 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 varC4 #------- ------- ------ ------- ------- ------- ------- -------- # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 # time point # P A E C P A E C # variance component #------------------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 # position ################################################################# #---------------------------------------------------------------- # BETA MATRIX #---------------------------------------------------------------- ################################################################# # To understand why we choose the position like we do, consider the columns of BETA to be the variables # which you want to use to as regressors, whereas the rows have the variables which you want to regress on. # So if I want to regress X1 and X2 on Y1 , #------------- # X1 X2 X3 # Y1 b1 b2 0 # Y2 0 0 0 #------------- #------------- # WITHIN TWIN MATRICES #------------- # As we can see in the model, we 'regress' the A, E and C on P. However, as we estimate the variance of these constructs # in the psy matrix, we set all the regression coefficients between A,E,C and P equal to 1. # This is what is done in the within twin matrices in the matrix Beta. # Additionally we can specify here also the auto-regressions between the constructs. # As we see in the model we have 3 autoregressions in case of the ACE model: # BAA: A-->A-->A-->A. # BCC: C-->C-->C-->C # BEE: E-->E-->E-->E # when specifying the AE* model, BCC is set to zero # We specify these autoregression for the within twin matrices as dictated in the Path diagram. # Editionally, we see that within twin, we regress the Phenotype P on the environment E. # bPEw: Ph --> E Ph --> E Ph --> E #------------- # BETWEEN TWIN MATRICES #------------- # We see that between twin, we regress the Phenotype P on the environment E. # BPEb: Ph --> E Ph --> E Ph --> E #------------- # STRUCTURE OF BETA #------------- # As you can see, BETA is not symmetric, therefore we need to specify two times the between twin matrix for Beta #--------------------------------------------------------------- ## 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 position # Twin 1 Twin 2 # P A E C P A E C #---------------------------------------------------------------- # within twin 1 # between twins #P 0 I I I 0 0 0 0 P 1-4 #A 0 BAA 0 0 0 0 0 0 A 5-8 #E BPEw 0 BEE 0 BPEb 0 0 0 E 9-12 #C 0 0 0 BCC 0 0 0 0 C 13-16 # between twins # within twin 2 #P 0 0 0 0 0 I I I P 17-20 #A 0 0 0 0 0 BAA 0 0 A 21-24 #E BPEb 0 0 0 BPEw 0 BEE 0 E 25-28 #C 0 0 0 0 0 0 0 BCC C 29-32 #--------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # Twin 1 Twin 2 #---------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 # # # So if we unfold matrix BETA #---------------------------------------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 # position #---------------------------------------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------------------------------------- # Within twin between twins # P A E C P A E C # component # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 # time point #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 2 P 1-4 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 3 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 4 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # 0 0 0 0 bA1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 2 A 5-8 # 0 0 0 0 0 bA2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 3 # 0 0 0 0 0 0 bA3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 4 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # bPEw1 0 0 0 0 0 0 0 bE1 0 0 0 0 0 0 0 bPEb1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 2 E 9-12 # 0 bPEw2 0 0 0 0 0 0 0 bE2 0 0 0 0 0 0 0 bPEb2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 3 # 0 0 bPEw3 0 0 0 0 0 0 0 bE3 0 0 0 0 0 0 0 bPEb3 0 0 0 0 0 0 0 0 0 0 0 0 0 # 4 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # 0 0 0 0 0 0 0 0 0 0 0 0 bC1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 2 C 13-16 # 0 0 0 0 0 0 0 0 0 0 0 0 0 bC2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 3 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bC3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 4 # between twins within twin 2 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 2 P 17-20 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 3 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 4 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bA1 0 0 0 0 0 0 0 0 0 0 0 # 2 A 21-24 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bA2 0 0 0 0 0 0 0 0 0 0 # 3 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bA3 0 0 0 0 0 0 0 0 0 # 4 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # bPEb1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bPEw1 0 0 0 0 0 0 0 bE1 0 0 0 0 0 0 0 # 2 E 25-28 # 0 bPE2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bPEw2 0 0 0 0 0 0 bE2 0 0 0 0 0 0 # 3 # 0 0 bPE3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bPE3 0 0 0 0 0 0 bE3 0 0 0 0 0 # 4 #--------- -------- ------- ------- ------- -------- ------- ------- # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # 1 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bC1 0 0 0 # 2 C 29-32 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bC2 0 0 # 3 # 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bC3 0 # 4 #---------------------------------------------------------------------------------------------- # 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 # time point # P A E C P A E C # component #---------------------------------------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------------------------------------- # 1-4 5-8 9-12 13-16 17-20 21-24 25-28 29-32 # position # NOTE: if we drop C, the regression coefficient of C are fixed to zero #------------- # STRUCTURE OF THETA #------------- # Within theta we estimate the time dependent variances of a, c and e. So theta is composed out of three matrices # theta = thetaA + thetaE + thetaC. #---------------------------------------------------------------- # 1 2 3 4 5 6 7 8 position #---------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # within twin 1 #P 0 1 #A 0 theta 2 #E 0 0 theta 3 #C 0 0 0 theta 4 # between twin # within twin 2 #P 0 0 0 0 0 5 #A 0 * 0 0 0 theta 6 #E 0 0 * 0 0 0 theta 7 #C 0 0 0 * 0 0 0 theta 8 #---------------------------------------------------------------- # P A E C P A E C #---------------------------------------------------------------- # twin 1 twin 2 #---------------------------------------------------------------- # 1 2 3 4 5 6 7 8 position #---------------------------------------------------------------- # NOTE the * are estimated in case of thetaA and thetaC, for thetaE they are zero