aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_residuals.R
blob: f70ad224eba5d69f4b46db590317167f429ae1ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
context("Residuals extracted from mkinfit models")

test_that("Residuals are correctly returned", {
  f <- fits[["FOMC", "FOCUS_C"]]
  expect_equal(residuals(f)[1:3], c(-0.7748906, 2.7090589, -1.9451989))

  expect_equivalent(
    residuals(f, standardized = TRUE)[1:3],
    c(-0.4171812, 1.4584875, -1.0472450), tolerance = 0.0001)

  expect_equivalent(
    residuals(fit_obs_1, standardized = TRUE)[1:3],
    c(-0.21771169, -0.33576060, 2.02836138),
    tolerance = 1e-6)

  expect_equivalent(
    residuals(fit_tc_1, standardized = TRUE)[1:3],
    c(-0.2474499, -0.3794267, 2.2749216),
    tolerance = 1e-6)
})

Contact - Imprint