File: test-gls.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 (38 lines) | stat: -rw-r--r-- 840 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
32
33
34
35
36
37
38
skip_if_not_installed("nlme")
data(Ovary, package = "nlme")
m1 <- nlme::gls(follicles ~ sin(2 * pi * Time) + cos(2 * pi * Time),
  data = Ovary,
  correlation = nlme::corAR1(form = ~ 1 | Mare)
)

test_that("ci", {
  expect_equal(
    ci(m1)$CI_low,
    c(10.90853, -4.04402, -2.2722),
    tolerance = 1e-4
  )
})

test_that("se", {
  expect_equal(
    standard_error(m1)$SE,
    c(0.664643651063474, 0.645047778144975, 0.697538308948056),
    tolerance = 1e-4
  )
})

test_that("p_value", {
  expect_equal(
    p_value(m1)$p,
    c(2.6187369542827e-51, 2.28628382225752e-05, 0.198137111907874),
    tolerance = 1e-4
  )
})

test_that("model_parameters", {
  expect_equal(
    model_parameters(m1)$Coefficient,
    c(12.2163981810227, -2.77471219793581, -0.899604717105857),
    tolerance = 1e-4
  )
})