! 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 ! ! Downloading Mx software: http://www.vcu.edu/mx ! Mx script's library: http://www.psy.vu.nl/mxbib ! ! REMARKS : ! 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 ACE 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 Q Full 1 1 End Matrices; Matrix X .5477 !Provide the simulated values for A, D and E Matrix W .4472 Matrix Z .7071 Matrix H .5 !Genetic correlations 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 !Nr of variables in the data file Matrices= Group 1 Covariances A+D+E | A+D _ !MZ variance-covariance matrix A+D | A+D+E ; Options MX%E=mzsim.cov !Write the simulated covariance matrix on a file End G3: DZ twin pairs Calculation NInput_vars=2 Matrices= Group 1 Covariances A+D+E | H@A+Q@D _ !DZ variance-covariance matrix H@A+Q@D | A+D+E ; Options MX%E=dzsim.cov !Write the simulated covariance matrix on a file End !______________________________________________________________ ! Step 2: Fit the wrong model to the simulated data ! Fix the D component to zero to estimate power #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 ! Genetic correlations Q Full 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=2 NObservations=1000 !Provide an arbitrary sample size CMatrix Full File=mzsim.cov !Read the simulated MZ cov-matrix Matrices= Group 1 Covariances A+D+E | A+D _ A+D | A+D+E ; Option RSiduals End G3: DZ twin pairs Data NInput_vars=2 NObservations=1000 CMatrix Full File=dzsim.cov Matrices= Group 1 Covariances A+D+E | H@A+Q@D _ H@A+Q@D | A+D+E ; Start .5 All Options RSiduals Power= .1,1 ! for 1 tailed .05 probability value & 1 df End