# NOT RUN {
# =====================================================
# = N for .8 power to detect a^2 = .5 equal MZ and DZ =
# =====================================================
power.ACE.test(AA = .5, CC = 0, update = "a")
# Suggests n = 84 MZ and 94 DZ pairs.
# }
# NOT RUN {
# ================================
# = Show power across range of N =
# ================================
power.ACE.test(AA= .5, CC= 0, update = "a", search = TRUE)
# Salutary note: You need well fitting models with correct betas in the data
# for power to be valid.
# tryHard helps ensure this, as does the default nSim= 4000 pair data.
# Power is important to get right, so I recommend using tryHard = "yes" (the default)
power.ACE.test(AA= .5, CC= 0, update = "a")
# =====================
# = Power to detect C =
# =====================
# 102 of each of MZ and DZ pairs for 80% power.
power.ACE.test(AA= .5, CC= .3, update = "c")
# ==========================================
# = Set 'a' to a fixed, but non-zero value =
# ==========================================
power.ACE.test(update= "a", value= sqrt(.2), AA= .5, CC= 0)
# ========================================
# = Drop More than one parameter (A & C) =
# ========================================
# E vs AE: the hypothesis that twins show no familial similarity.
power.ACE.test(update = "a_after_dropping_c", AA= .5, CC= .3)
# ===================================================
# = More power to detect A > 0 when more C present =
# ===================================================
power.ACE.test(update = "a", AA= .5, CC= .0)
power.ACE.test(update = "a", AA= .5, CC= .3)
# ====================================================
# = More power to detect C > 0 when more A present? =
# ====================================================
power.ACE.test(update = "c", AA= .0, CC= .5)
power.ACE.test(update = "c", AA= .3, CC= .5)
# ===============================================
# = Power with more DZs than MZs and vice versa =
# ===============================================
# Power about the same: total pairs with 2 MZs per DZ = 692, vs. 707
power.ACE.test(MZ_DZ_ratio= 2/1, update= "a", AA= .3, CC= 0, method="ncp", tryHard="yes")
power.ACE.test(MZ_DZ_ratio= 1/2, update= "a", AA= .3, CC= 0, method="ncp", tryHard="yes")
# =====================================
# = Compare ncp and empirical methods =
# =====================================
# Compare to empirical mode: suggests 83.6 MZ and 83.6 DZ pairs
power.ACE.test(update= "a", AA= .5, CC= 0, method= "empirical")
# method= "empirical": For 80% power, you need 76 MZ and 76 DZ pairs
power.ACE.test(update= "a", AA= .5, CC= 0, method = "ncp")
# method = "ncp": For 80% power, you need 83.5 MZ and 83.5 DZ pairs
# ====================
# = Show off options =
# ====================
# 1. tryHard
power.ACE.test(update = "a", AA= .5, CC= 0, tryHard= "no")
# 2. toggle optimizer
power.ACE.test(update= "a", AA= .5, CC= 0, optimizer= "SLSQP")
# 3. How many twin pairs in the base simulated data?
power.ACE.test(update = "a", AA= .5, CC= 0)
power.ACE.test(update = "a", AA= .5, CC= 0, nSim= 20)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab