Presentation is loading. Please wait.

Presentation is loading. Please wait.

Univariate Model Fitting Sarah Medland QIMR – openMx workshop Brisbane 16/08/10.

Similar presentations


Presentation on theme: "Univariate Model Fitting Sarah Medland QIMR – openMx workshop Brisbane 16/08/10."— Presentation transcript:

1 Univariate Model Fitting Sarah Medland QIMR – openMx workshop Brisbane 16/08/10

2 Univariate Twin Models = using the twin design to assess the aetiology of one trait (univariate) 1. Path Diagrams 2. Basic ACE R Script

3 1. Path Diagrams for Univariate Models

4 Basic Twin Model - MZ Twin 1 Trait ACE c e a Twin 2 Trait ECA c a e

5 Basic Twin Model - DZ Twin 1 Trait ACE c e a Twin 2 Trait ECA c a e

6 Basic Twin Model Twin 1 Trait ACE c e a Twin 2 Trait ECA c a e rMZ = 1.0; rDZ = 1.0 rMZ = 1.0; rDZ =

7 The Variance Since the variance of a variable is the covariance of the variable with itself, the expected variance will be the sum of all paths from the variable to itself, which follow Wright’s rules

8 Variance for Twin 1 - A Twin 1 Trait ACE c e a 11 1 a*1*a = a 2

9 Variance for Twin 1 - C a*1*a = a 2 c*1*c = c 2 Twin 1 Trait ACE c e a 11 1

10 Variance for Twin 1 - E a*1*a = a 2 c*1*c = c 2 e*1*e = e 2 Twin 1 Trait ACE c e a 11 1

11 Total Variance for Twin 1 a*1*a = a 2 c*1*c = c 2 e*1*e = e 2 Twin 1 Trait ACE c e a 11 1 Total Variance = a 2 + c 2 + e 2

12 Covariance - MZ Twin 1 Trait ACE c e a Twin 2 Trait ECA c a e a2 + c2a2 + c2

13 Covariance - DZ Twin 1 Trait ACE c e a Twin 2 Trait ECA c a e a 2 + c 2

14 Variance-Covariance Matrices MZTwin 1Twin 2 Twin 1a 2 + c 2 + e 2 a 2 + c 2 Twin 2a 2 + c 2 a 2 + c 2 + e 2

15 Variance-Covariance Matrices DZTwin 1Twin 2 Twin 1a 2 + c 2 + e 2 0.5a 2 + c 2 Twin 20.5a 2 + c 2 a 2 + c 2 + e 2

16 Variance-Covariance Matrices MZ Twin 1Twin 2 Twin 1a 2 + c 2 + e 2 a 2 + c 2 Twin 2a 2 + c 2 a 2 + c 2 + e 2 DZ Twin 1Twin 2 Twin 1a 2 + c 2 + e 2 0.5a 2 + c 2 Twin 20.5a 2 + c 2 a 2 + c 2 + e 2

17 Why isn’t e 2 included in the covariance? Because, e 2 refers to environmental influences UNIQUE to each twin. Therefore, this cannot explain why there is similarity between twins. Why is a 2 only.5 for DZs but not MZs? Because DZ twins share on average half of their genes, whereas MZs share all of their genes.

18 2. Basic openMx ACE Script

19 Overview OpenMx script Running the script Describing the output

20 ACE model # Fit ACE Model with RawData and Matrices Input # univACEModel <- mxModel("univACE", mxModel("ACE", # Matrices a, c, and e to store a, c, and e path coefficients mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=10, label="a11", name="a" ), mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=10, label="c11", name="c" ), mxMatrix( type="Lower", nrow=nv, ncol=nv, free=TRUE, values=10, label="e11", name="e" ), # Matrices A, C, and E compute variance components mxAlgebra( expression=a %*% t(a), name="A" ), mxAlgebra( expression=c %*% t(c), name="C" ), mxAlgebra( expression=e %*% t(e), name="E" ), # Algebra to compute total variances and standard deviations (diagonal only) mxAlgebra( expression=A+C+E, name="V" ), Specify the matrices you need To build the model Twin 1 Trait ACE c e a 11 1 Do some algebra to get the variances

21 Start values? a 2 = additive genetic variance (A) c 2 = Shared E variance (C) e 2 = Non-shared E variance (E) Sum is modelled to be expected Total Variance Start Values for a, c, e:  (Total Variance / 3) Twin 1 Trait ACE c e a 11 1

22 Standardize parameter estimates The regression coefficient a is standardized by: (a * SD(A)) / SD(Trait) where SD(Trait) is the standard deviation of the dependent variable, and SD(A) is the standard deviation of the predictor, the latent factor ‘A’ (=1) Twin 1 Trait A a 1 V1 * = V VV SD inv = 1/SD a * = a/SD

23 Standardize parameter estimates # Algebra to compute total variances and standard deviations (diagonal only) mxAlgebra( expression=A+C+E, name="V" ), mxMatrix( type="Iden", nrow=nv, ncol=nv, name="I"), mxAlgebra( expression=solve(sqrt(I*V)), name="iSD"), # Algebra to compute standardized path estimares and variance components mxAlgebra( expression=a%*%iSD, name="sta"), mxAlgebra( expression=c%*%iSD, name="stc"), mxAlgebra( expression=e%*%iSD, name="ste"), mxAlgebra( expression=A/V, name="h2"), mxAlgebra( expression=C/V, name="c2"), mxAlgebra( expression=E/V, name="e2"), The heritability ‘h 2 ’ is the proportion of the total variance due to A (additive genetic effects; = A / V. Note: this will be “sta” squared. The standardized variance components for C and E are: C / V; E / V N Twin 1 Trait A sta 1 VA / = “h2 ” “sta” 2

24 Standardising data V = A + C + EA/V=73/233=.31 V = [73] + [90] + [70]C/V=90/233=.39 V = [233]E/V=70/233=.30 a = 8.55 c = 9.49 e = 8.35 SD = sqrt(V)=15.26 sta = 8.55 / = 0.56squared =.31 stc = 9.49 / = 0.62 squared =.39 ste = 8.35 / = 0.55 squared =.30

25 # Algebra for expected variance/covariance matrix in MZ mxAlgebra( expression= rbind ( cbind(A+C+E, A+C), cbind(A+C, A+C+E)), name="expCovMZ" ), # Algebra for expected variance/covariance matrix in DZ mxAlgebra( expression= rbind ( cbind(A+C+E, 0.5%x%A+C), cbind(0.5%x%A+C, A+C+E)), name="expCovDZ" ) MZTwin 1Twin 2 Twin 1a 2 + c 2 + e 2 a 2 + c 2 Twin 2a 2 + c 2 a 2 + c 2 + e 2 DZTwin 1Twin 2 Twin 1a 2 + c 2 + e 2 0.5a 2 + c 2 Twin 20.5a 2 + c 2 a 2 + c 2 + e 2 Twin 1 Trait ACE c e a Twin 2 Trait ECA c a e 1/

26 mxModel("MZ", mxData( observed=mzData, type="raw" ), mxFIMLObjective( covariance="ACE.expCovMZ", means="ACE.expMean", dimnames=selVars ) ), mxModel("DZ", mxData( observed=dzData, type="raw" ), mxFIMLObjective( covariance="ACE.expCovDZ", means="ACE.expMean", dimnames=selVars ) ), mxAlgebra( expression=MZ.objective + DZ.objective, name="m2ACEsumll" ), mxAlgebraObjective("m2ACEsumll"), mxCI(c('ACE.A', 'ACE.C', 'ACE.E')) ) univACEFit <- mxRun(univACEModel, intervals=T) univACESumm <- summary(univACEFit) univACESumm

27 Sub-models # Fit AE model # univAEModel <- mxModel(univACEFit, name="univAE", mxModel(univACEFit$ACE, mxMatrix( type="Lower", nrow=1, ncol=1, free=FALSE, values=0, label="c11", name="c" ) ) ) univAEFit <- mxRun(univAEModel) univAESumm <- summary(univAEFit) univAESumm You can fit sub-models to test the significance of your parameters -you simply drop the parameter and see if the model fit is significantly worse than full model Twin 1 Trait AE Twin 2 Trait EA

28 Sub-models # Fit CE model # univCEModel <- mxModel(univACEFit, name="univCE", mxModel(univACEFit$ACE, mxMatrix( type="Lower", nrow=1, ncol=1, free=FALSE, values=0, label="a11", name="a" ) ) ) univCEFit <- mxRun(univCEModel) univCESumm <- summary(univCEFit) univCESumm Twin 1 Trait CE Twin 2 Trait EC # Fit E model # univEModel <- mxModel(univAEFit, name="univE", mxModel(univAEFit$ACE, mxMatrix( type="Lower", nrow=1, ncol=1, free=FALSE, values=0, label="a11", name="a" ) ) ) univEFit <- mxRun(univEModel) univESumm <- summary(univEFit) univESumm Twin 1 Trait E Twin 2 Trait E The E parameter can never not be dropped because it includes measurement error

29 OpenMx Output

30 univACESumm free parameters: name matrix row col Estimate 1 a11 ACE.a c11 ACE.c e11 ACE.e mean ACE.Mean observed statistics: 2198 estimated parameters: 4 degrees of freedom: log likelihood: saturated -2 log likelihood: NA number of observations: 1110 chi-square: NA p: NA AIC (Mx): BIC (Mx): adjusted BIC: RMSEA: NA

31 tableFitStatistics models compared to saturated model Name ep -2LL df AIC diffLL diffdf p M1 : univTwinSat M2 : univACE M3 : univAE M4 : univCE M5 : univE Smaller -2LL means better fit. -2LL of sub-model is always higher (worse fit). The question is: is it significantly worse. Chi-sq test: dif in -2LL is chi-square distributed. Evaluate sig of chi-sq test. A non-sig p-value means that the model is consistent with the data.

32 Nested.fit models compared to ACE model Name ep -2LL df diffLL diffdf p univACE NA NA NA univAE univCE univE Smaller -2LL means better fit. -2LL of sub-model is always higher (worse fit). The question is: is it significantly worse. Chi-sq test: dif in -2LL is chi-square distributed. Evaluate sig of chi-sq test. Critical Chi-sq value for 1 DF = 3.84 A non-sig p-value means that the dropped parameter(s) are non-significant.

33 Estimates ACE model > univACEFit$ACE.h2 [,1] [1,] > univACEFit$ACE.c2 [,1] [1,] > univACEFit$ACE.e2 [,1] [1,]


Download ppt "Univariate Model Fitting Sarah Medland QIMR – openMx workshop Brisbane 16/08/10."

Similar presentations


Ads by Google