File: test-model_parameters.afex_aov.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 (27 lines) | stat: -rw-r--r-- 1,027 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
test_that("afex_aov", {
  skip_if_not_installed("afex")

  data(obk.long, package = "afex")
  m_between <- suppressMessages(suppressWarnings(
    afex::aov_car(value ~ treatment * gender + Error(id), data = obk.long)
  ))
  m_within <- suppressMessages(suppressWarnings(
    afex::aov_car(value ~ Error(id / (phase * hour)), data = obk.long)
  ))

  mp1 <- model_parameters(m_between, verbose = FALSE)
  mp2 <- model_parameters(m_within, verbose = FALSE)

  expect_equal(c(nrow(mp1), ncol(mp1)), c(5, 7))
  expect_equal(mp1$Sum_Squares, c(450.62069, 11.98202, 5.56322, 8.68275, 15.2037), tolerance = 1e-3)
  expect_equal(c(nrow(mp2), ncol(mp2)), c(3, 9))
  expect_equal(mp2$Sum_Squares, c(167.5, 106.29167, 11.08333), tolerance = 1e-3)
  expect_equal(
    colnames(mp1),
    c("Parameter", "Sum_Squares", "df", "Mean_Square", "F", "p", "Method")
  )
  expect_equal(
    colnames(mp2),
    c("Parameter", "Sum_Squares", "Sum_Squares_Error", "df", "df_error", "Mean_Square", "F", "p", "Method")
  )
})