tests/testthat/test-examples-fastcpd_ar_2.R

testthat::test_that(
  "examples/fastcpd_ar_2.R", {
    testthat::skip_if_not_installed("ggplot2")

    source("examples/fastcpd_ar_2.R")
    testthat::expect_equal(result@cp_set, 614)
    testthat::expect_lt(
      abs(median(result@residuals, na.rm = TRUE) + 0.11998684), 1e-8
    )
    testthat::expect_equal(result@thetas, data.frame(
      "segment 1" = c(0.57120256, -0.20985108, 0.08221978),
      "segment 2" = c(0.237180884, 0.403124372, 0.229032322),
      check.names = FALSE
    ))
  }
)

Try the fastcpd package in your browser

Any scripts or data that you put into this service are public.

fastcpd documentation built on April 12, 2025, 1:43 a.m.