# NOT RUN {
# =====================================================================
# = Basic Example, with all elements of std univariate data specified =
# =====================================================================
tmp = umx_make_TwinData(nMZpairs = 100, nDZpairs = 100, AA = .36, CC = .04, EE = .60)
# Show list of 2 data sets
str(tmp)
# = How to consume the built datasets =
mzData = tmp[[1]];
dzData = tmp[[2]];
cov(mzData); cov(dzData)
str(mzData); str(dzData);
# Prefer to work in path coefficient values? (little a?)
tmp = umx_make_TwinData(200, AA = .6^2, CC = .2^2)
# Check the correlations
umxAPA(tmp[[1]]); umxAPA(tmp[[2]])
# =============
# = Shortcuts =
# =============
# Omit nDZpairs (equal numbers of both by default)
tmp = umx_make_TwinData(nMZpairs = 100, nDZpairs = 100, AA = .36, CC = .04, EE = .60)
tmp = umx_make_TwinData(100, AA = 0.5, CC = 0.3) # omit any one of A, C, or E (sums to 1)
cov(tmp[[1]])
# Not limited to unit variance
tmp = umx_make_TwinData(100, AA = 3, CC = 2, EE = 3, sum2one = FALSE)
cov(tmp[[1]])
# =====================
# = Moderator Example =
# =====================
x = umx_make_TwinData(100, AA = c(avg = .7, min = 0, max = 1), CC = .55, EE = .63)
str(x)
# =====================
# = Threshold Example =
# =====================
tmp = umx_make_TwinData(100, AA = .6, CC = .2, nThresh = 3)
str(tmp)
umxAPA(tmp[[1]]); umxAPA(tmp[[2]])
# ========================
# = Just use MZr and DZr =
# ========================
tmp = umx_make_TwinData(100, MZr = .86, DZr= .60, varNames = "IQ")
umxAPA(tmp[[1]]); umxAPA(tmp[[2]])
# }
Run the code above in your browser using DataLab