## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment  = "#>",
  eval     = FALSE   # stub: set TRUE when verifying locally with current OpenMx/umx
)
library(umx)
umx_set_auto_plot(FALSE)

## ----load-data----------------------------------------------------------------
# data(Psych_LDSC, package = "umx")
# str(Psych_LDSC, max.level = 1)
# # names: V, S, I, N, m
# # S is 5×5 genetic covariance; V is 15×15 sampling covariance of vech(S)
# colnames(Psych_LDSC$S)

## ----fit-umxGSEM--------------------------------------------------------------
# m1 = umxGSEM(
#   model      = "g ~= SCZ + BIP + MDD + EA + INSOM",
#   covstruc   = Psych_LDSC,
#   estimation = "DWLS"
# )
# umxSummary(m1)

## ----fit-lavaan-syntax--------------------------------------------------------
# m1b = umxGSEM(
#   model = "
#     g =~ NA*SCZ + BIP + MDD + EA + INSOM
#     g ~~ 1*g
#   ",
#   covstruc   = Psych_LDSC,
#   estimation = "DWLS",
#   std.lv     = FALSE
# )

## ----tmx-data-----------------------------------------------------------------
# tmx_show(m1, matrices = c("data.S", "data.V", "data.W"), report = "markdown")

## ----gsem-sumstats-toy, eval = FALSE------------------------------------------
# tut = umxGSEM_dl_tutorial_files()
# snps = umxGSEM_sumstats(
#   files = tut$sumstats,
#   ref = tut$ref,
#   trait.names = c("SCZ", "BIP", "MDD"),
#   se.logit = TRUE
# )
# gwas = umxGSEM_GWAS(covstruc = Psych_LDSC, SNPs = snps,
#   traits = c("SCZ", "BIP", "MDD"), maxSNPs = 50)

## ----session, eval = TRUE-----------------------------------------------------
sessionInfo()

