! Simulate the data ! 30% additive genetic ! 20% common environment ! 50% nonshared environment #NGroups 3 G1: model parameters Calculation Begin Matrices; X lower 1 1 fixed Y lower 1 1 fixed Z lower 1 1 fixed End Matrices; Matrix X 0.5477 !Unsquared Estimate for A of .3 Matrix Y 0.4472 !Unsquared Estimate for C of .2 Matrix Z 0.7071 !Unsquared Estimate for E of .5 Begin Algebra; A = X*X' ; C = Y*Y' ; E = Z*Z' ; End Algebra; End G2: MZ twin pairs Calculation Matrices = Group 1 Covariances A+C+E | A+C _ A+C | A+C+E / Options MX%E=mzsim.cov !Stores the MZ Cov. matrix in mzsim.cov End G3: DZ twin pairs Calculation Matrices = Group 1 H Full 1 1 Covariances A+C+E | H@A+C _ H@A+C | A+C+E / Matrix H 0.5 Options MX%E=dzsim.cov !Stores the DZ Cov. matrix in mzsim.cov End ! Second part of script ! Fit the wrong model to the simulated data ! to calculate power #NGroups 3 G1 : model parameters Calculation Begin Matrices; X lower 1 1 free Y lower 1 1 fixed !Dropped C from model for test of power Z lower 1 1 free End Matrices; Begin Algebra; A = X*X' ; C = Y*Y' ; E = Z*Z' ; End Algebra; End G2 : MZ twins Data NInput_vars=2 NObservations=350 !Necessary to specify NObservations for baseline CMatrix Full File=mzsim.cov !Supplies the covariance matrix from above for MZ Matrices= Group 1 Covariances A+C+E | A+C _ A+C | A+C+E / Option RSiduals End G3 : DZ twins Data NInput_vars=2 NObservations=350 !Necessary to specify NObservations for baseline CMatrix Full File=dzsim.cov !Supplies the covariance matrix from above for MZ Matrices= Group 1 H Full 1 1 Covariances A+C+E | H@A+C _ H@A+C | A+C+E / Matix H 0.5 Option RSiduals ! Power for alpha = 0.05 and 1 df Option Power= 0.05,1 !Asks for power levels where alpha=.05 End