Debian Codegraph @

tests/testthat/test-polca.R

raw
1 skip_on_cran()
2
3 skip_if_not_installed("modeltests")
4 library(modeltests)
5
6 skip_if_not_installed("poLCA")
7 skip_if_not_installed("MASS")
8 suppressPackageStartupMessages(library(poLCA))
9
10 data(values)
11 fit <- poLCA(cbind(A, B, C, D) ~ 1, values, nclass = 2, verbose = FALSE)
12
13 test_that("poLCA tidier arguments", {
14 check_arguments(tidy.poLCA)
15 check_arguments(glance.poLCA)
16 check_arguments(augment.poLCA)
17 })
18
19 test_that("tidy.poLCA", {
20 td <- tidy(fit)
21 check_tidy_output(td)
22 check_dims(td, 16, 5)
23 })
24
25 test_that("glance.poLCA", {
26 gl <- glance(fit)
27 check_glance_outputs(gl)
28 check_dims(gl, expected_cols = 8)
29 })
30
31 test_that("augment.poLCA", {
32 au <- augment(fit)
33
34 check_augment_function(
35 aug = augment.poLCA,
36 model = fit,
37 data = values,
38 newdata = values,
39 strict = FALSE
40 )
41 })