poissonconsulting / mcmcr

An R package to manipulate MCMC samples
https://poissonconsulting.github.io/mcmcr/
Other
17 stars 2 forks source link

ESS is different for different OS when parameter is fixed #58

Closed sebdalgarno closed 10 months ago

sebdalgarno commented 11 months ago

this was causing a test in bboutools to fail for all but windows in actions cmd-check on windows and locally, ESS of fixed parameter is 3 on macOS-latest and other ubuntu releases, ESS is 3000

I think the underlying issue occurs in .esr_numeric, where the output of this will change

x <- bboutools:::fit_recruitment$samples[[1]]
.esr_numeric(x[,,1][1,], na_rm = FALSE)

in this case the fit_recruitment object has adult_female_proportion parameter fixed at 0.65 and fit_recruitment$samples[[1]] contains the samples for adult_female_proportion (all 0.65)

the esr output of above for me locally is 0.001 but will be 1 on macOS-latest

sebdalgarno commented 11 months ago

pass on windows is actually due to the expect_snapshot_data function not behaviour of mcmcr

expect_snapshot_data <- function(x, name) {
  testthat::skip_on_os("windows")
  path <- save_csv(x)
  testthat::expect_snapshot_file(path, paste0(name, ".csv"))
}
joethorley commented 10 months ago

@sebdalgarno - I've fixed on main branch