File: test-parameters_table.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
skip_if_not_installed("effectsize")
skip_if_not_installed("insight")

test_that("parameters_table 1", {
  x <- model_parameters(lm(Sepal.Length ~ Species, data = iris), standardize = "refit")
  tab <- insight::format_table(x)
  expect_equal(colnames(tab), c("Parameter", "Coefficient", "SE", "95% CI", "t(147)", "p"))
})

test_that("parameters_table 2", {
  skip_if_not_installed("lme4")
  x <- model_parameters(lme4::lmer(Sepal.Length ~ Petal.Length + (1 | Species), data = iris), effects = "fixed")
  tab <- insight::format_table(x)
  expect_true(all(names(tab) == c("Parameter", "Coefficient", "SE", "95% CI", "t(146)", "p", "Effects")))
})

test_that("parameters_table 3", {
  x <- effectsize::effectsize(lm(Sepal.Length ~ Species, data = iris))
  tab <- insight::format_table(x)
  expect_equal(colnames(tab), c("Parameter", "Std. Coef.", "95% CI"))
})

test_that("parameters_table 4", {
  x <- model_parameters(lm(Sepal.Length ~ Species, data = iris), standardize = "posthoc")
  tab <- insight::format_table(x)
  expect_equal(colnames(tab), c("Parameter", "Std. Coef.", "SE", "95% CI", "t(147)", "p"))
})

# x <- report::report_table(lm(Sepal.Length ~ Species, data=iris))  # Once on CRAN
# t <- insight::format_table(x)
# t