! SCRIPT NAME : powerADEtwins.mx (db) ! GOAL : To calculate power to test significance of A and/or D ! DATA : continuous ! INPUT : calculated covariance matrices ! UNI/BI/MULTI : uni ! DATA-GROUPS : MZ DZ (+parents) ! ! Downloading Mx software: http://www.vcu.edu/mx ! Mx script's library: http://www.psy.vu.nl/mxbib ! ! REMARKS : ! Assuming no assortative mating ! First: generate full model, then drop one parameter to test the power to detect that parameter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Step 1: Simulate the data for power calculation of ADE model ! 30% additive genetic (.5477²=.3) ! 20% Non Additive genetic (.4472²=.2) ! 50% random environment (.7071²=.5) #NGroups 3 G1: model parameters Calculation Begin Matrices; X Lower 1 1 Fixed ! genetic structure W Lower 1 1 Fixed ! non-additive genetic structure Z Lower 1 1 Fixed ! specific environmental structure H Full 1 1 ! Genetic correlations Q Full 1 1 O Zero 1 1 ! Zero matrix for spouse correlation End Matrices; Matrix X .5477 ! Provide true values to simulate Matrix W .4472 Matrix Z .7071 Matrix H .5 Matrix Q .25 Begin Algebra; ! Square the path coefficients A= X*X' ; D= W*W' ; E= Z*Z' ; End Algebra; End G2: MZ twin pairs Calculation NInput_vars=2 Matrices= Group 1 Covariances A+D+E | A+D | H@A | H@A _ !4x4 variance-covariance matrix A+D | A+D+E | H@A | H@A _ H@A | H@A | A+D+E | O _ H@A | H@A | O | A+D+E ; Options MX%E=mzsim.cov !save the simulated var-cov matrix into a file End G3: DZ twin pairs Calculation NInput_vars=2 Matrices= Group 1 Covariances A+D+E | H@A+Q@D | H@A | H@A _ H@A+Q@D | A+D+E | H@A | H@A _ H@A | H@A | A+D+E | O _ H@A | H@A | O | A+D+E ; Options MX%E=dzsim.cov End !______________________________________________________________ ! Step 2: Fit the wrong model to the simulated data #NGroups 3 G1: model parameters Calculation Begin Matrices; X Lower 1 1 Free ! genetic structure W Lower 1 1 Fixed ! non-additive genetic structure (fixed to zero) Z Lower 1 1 Free ! specific environmental structure H Full 1 1 Q Full 1 1 O Zero 1 1 End Matrices; Matrix H .5 Matrix Q .25 Begin Algebra; A= X*X' ; D= w*w' ; E= Z*Z' ; End Algebra; End G2: MZ twin pairs Data NInput_vars=4 NObservations=1000 CMatrix Full File=mzsim.cov !Read the simulated MZ var-cov matrix Matrices= Group 1 Covariances A+D+E | A+D | H@A | H@A _ A+D | A+D+E | H@A | H@A _ H@A | H@A | A+D+E | O _ H@A | H@A | O | A+D+E ; Option RSiduals End G3: DZ twin pairs Data NInput_vars=4 NObservations=1000 CMatrix Full File=dzsim.cov !Read the simulated DZ var-cov matrix Matrices= Group 1 Covariances A+D+E | H@A+Q@D | H@A | H@A _ H@A+Q@D | A+D+E | H@A | H@A _ H@A | H@A | A+D+E | O _ H@A | H@A | O | A+D+E ; Start .5 All Options RSiduals Power= .1,1 ! for 1 tailed .05 critical value & 1 df End