beanumber / tidychangepoint

Changepoint detection with a tidy interface
https://beanumber.github.io/tidychangepoint/
GNU General Public License v3.0
1 stars 1 forks source link

test failures on R-devel #110

Closed beanumber closed 3 months ago

beanumber commented 3 months ago
── Failure ('test-stats.R:62:3'): values match ─────────────────────────────────
round(trend_ar1$model_params[["sigma_hatsq"]], 3) (`actual`) not equal to 0.29 (`expected`).

  `actual`: 0.5
`expected`: 0.3
── Failure ('test-stats.R:65:3'): values match ─────────────────────────────────
round(as.numeric(logLik(trend_ar1))) (`actual`) not equal to round(-288.8) (`expected`).

  `actual`: -403
`expected`: -289
── Failure ('test-stats.R:66:3'): values match ─────────────────────────────────
round(BIC(trend_ar1)) (`actual`) not equal to round(654.19) (`expected`).

  `actual`: 883
`expected`: 654
── Failure ('test-stats.R:67:3'): values match ─────────────────────────────────
floor(MDL(trend_ar1)) (`actual`) not equal to floor(656.52) (`expected`).

  `actual`: 885
`expected`: 656
── Failure ('test-stats.R:68:3'): values match ─────────────────────────────────
round(trend_ar1$model_params[["phi_hat"]], 3) (`actual`) not equal to 0.058 (`expected`).

  `actual`: 1.0
`expected`: 0.1
── Failure ('test-stats.R:85:3'): values match ─────────────────────────────────
round(model_variance(trend_ar1_trunc), 3) (`actual`) not equal to 0.305 (`expected`).

  `actual`: 0.6
`expected`: 0.3
── Failure ('test-stats.R:86:3'): values match ─────────────────────────────────
round(trend_ar1_trunc$model_params[["phi_hat"]], 3) (`actual`) not equal to 0.073 (`expected`).

  `actual`: 1.0
`expected`: 0.1

[ FAIL 7 | WARN 0 | SKIP 10 | PASS 250 ]

Some of the tests are failing on R-devel, but not on R-release. My best guess is that this is releated to a change in behavior of head() and tail() in the development version of here, since I am using both functions on ts objects in the failing code. However, I have yet to isolate and fix the bug.

I think the problem is occurring in the autoregress_errors() function:

https://github.com/beanumber/tidychangepoint/blob/9b6f7647ff5fc1d5250661473d6a7be43a4a3010/R/class-mod_cpt.R#L259