File: test-model_parameters.maov.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 (16 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
fit <- lm(cbind(mpg, disp, hp) ~ factor(cyl), data = mtcars)
m <- aov(fit)
mp <- model_parameters(m)

test_that("model_parameters.maov", {
  expect_equal(
    mp$Sum_Squares,
    as.vector(do.call(c, lapply(summary(m), function(i) as.data.frame(i)$`Sum Sq`))),
    tolerance = 1e-3
  )
  expect_equal(
    mp[["F"]],
    as.vector(do.call(c, lapply(summary(m), function(i) as.data.frame(i)[["F value"]]))),
    tolerance = 1e-3
  )
})