## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(
  collapse   = TRUE,
  comment    = "#>",
  fig.align  = "center",
  fig.width  = 7,
  fig.height = 4.5,
  out.width  = "100%"
)

## ----install, eval = FALSE----------------------------------------------------
# # install.packages("remotes")
# remotes::install_github("rgempp/csemGT")

## ----fit----------------------------------------------------------------------
library(csemGT)
data(iowa_like)

set.seed(1998)
iowa_sub <- iowa_like[sample(nrow(iowa_like), 600), ]

fit <- csem_gt(iowa_sub, error_type = "relative", method = "full")

## ----print--------------------------------------------------------------------
fit

## ----summary------------------------------------------------------------------
summary(fit)

## ----plot---------------------------------------------------------------------
plot(fit)

## ----accessors----------------------------------------------------------------
str(fit, max.level = 1)

# variance components
coef(fit)

# by-score table as a data frame
head(by_score(fit))

