! Simulate the data ! 30% additive genetic ! 20% common environment ! 50% nonshared environment #NGroups 4 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.5 !Unsquared Estimate for F of .25 Matrix Y 0.4 !Unsquared Estimate for Q of .16 Matrix Z 0.77 !Unsquared Estimate for E of .59 Begin Algebra; F = X*X' ; Q = Y*Y' ; E = Z*Z' ; End Algebra; End G2: IBD2 pairs Calculation Matrices = Group 1 Covariances F+Q+E | F+Q _ F+Q | F+Q+E / Options MX%E=ibd2.cov !Stores the MZ Cov. matrix in mzsim.cov End G3: IBD1 pairs Calculation Matrices = Group 1 H Full 1 1 Covariances F+Q+E | F+H@Q _ F+H@Q | F+Q+E / Matrix H 0.5 Options MX%E=ibd1.cov !Stores the DZ Cov. matrix in mzsim.cov End G4: IBD0 pairs Calculation Matrices = Group 1 H Full 1 1 Covariances F+Q+E | F_ F | F+Q+E / Matrix H 0.5 Options MX%E=ibd0.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 4 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; F = X*X' ; Q = Y*Y' ; E = Z*Z' ; End Algebra; End G2 : ibd2 pairs Data NInput_vars=2 NObservations=350 !Necessary to specify NObservations for baseline CMatrix Full File=ibd2.cov !Supplies the covariance matrix from above for MZ Matrices= Group 1 Covariances F+Q+E | F+Q _ F+Q | F+Q+E / Option RSiduals End G3 : ibd1 pairs Data NInput_vars=2 NObservations=350 !Necessary to specify NObservations for baseline CMatrix Full File=ibd1.cov !Supplies the covariance matrix from above for MZ Matrices= Group 1 H Full 1 1 Covariances F+Q+E | F+H@Q _ F+H@Q | F+Q+E / Matix H 0.5 Option RSiduals End G4 : ibd0 pairs Data NInput_vars=2 NObservations=350 !Necessary to specify NObservations for baseline CMatrix Full File=ibd0.cov !Supplies the covariance matrix from above for MZ Matrices= Group 1 H Full 1 1 Covariances F+Q+E | F_ F | F+Q+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