diff --git a/src/test/unit/analyze/mcmc/ess_basic_test.cpp b/src/test/unit/analyze/mcmc/ess_basic_test.cpp index a010909140..101e9c793b 100644 --- a/src/test/unit/analyze/mcmc/ess_basic_test.cpp +++ b/src/test/unit/analyze/mcmc/ess_basic_test.cpp @@ -42,6 +42,7 @@ class EssBasic : public testing::Test { }; TEST_F(EssBasic, test_basic_ess) { + // computed via R pkg posterior double ess_lp_expect = 1335.4137; double ess_theta_expect = 1377.503; @@ -53,9 +54,9 @@ TEST_F(EssBasic, test_basic_ess) { auto old_ess_basic_theta = stan::analyze::compute_effective_sample_size(draws_theta, sizes); - EXPECT_NEAR(ess_lp_expect, ess_basic_lp, 0.0001); - EXPECT_NEAR(ess_theta_expect, ess_basic_theta, 0.0001); + EXPECT_NEAR(ess_lp_expect, ess_basic_lp, 1e-4); + EXPECT_NEAR(ess_theta_expect, ess_basic_theta, 1e-4); - EXPECT_NEAR(old_ess_basic_lp, ess_basic_lp, 0.00001); - EXPECT_NEAR(old_ess_basic_theta, ess_basic_theta, 0.00001); + EXPECT_NEAR(old_ess_basic_lp, ess_basic_lp, 1e-9); + EXPECT_NEAR(old_ess_basic_theta, ess_basic_theta, 1e-9); } diff --git a/src/test/unit/analyze/mcmc/mcse_test.cpp b/src/test/unit/analyze/mcmc/mcse_test.cpp index 45f4ce6ccc..92efc49b47 100644 --- a/src/test/unit/analyze/mcmc/mcse_test.cpp +++ b/src/test/unit/analyze/mcmc/mcse_test.cpp @@ -35,18 +35,19 @@ class MonteCarloStandardError : public testing::Test { }; TEST_F(MonteCarloStandardError, test_mcse) { - double mcse_mean_lp_expect = 0.020164778; - double mcse_mean_theta_expect = 0.0032339916; + // computed via R pkg posterior + double mcse_mean_lp_expect = 0.02016; + double mcse_mean_theta_expect = 0.00323; - double mcse_sd_lp_expect = 0.0355305; - double mcse_sd_theta_expect = 0.0021642137; - EXPECT_NEAR(mcse_mean_lp_expect, stan::analyze::mcse_mean(chains_lp), 0.0001); + double mcse_sd_lp_expect = 0.03553; + double mcse_sd_theta_expect = 0.00216; + EXPECT_NEAR(mcse_mean_lp_expect, stan::analyze::mcse_mean(chains_lp), 1e-4); EXPECT_NEAR(mcse_mean_theta_expect, stan::analyze::mcse_mean(chains_theta), - 0.0001); + 1e-4); - EXPECT_NEAR(mcse_sd_lp_expect, stan::analyze::mcse_sd(chains_lp), 0.0001); + EXPECT_NEAR(mcse_sd_lp_expect, stan::analyze::mcse_sd(chains_lp), 1e-4); EXPECT_NEAR(mcse_sd_theta_expect, stan::analyze::mcse_sd(chains_theta), - 0.0001); + 1e-4); } TEST_F(MonteCarloStandardError, const_fail) { diff --git a/src/test/unit/analyze/mcmc/rhat_basic_test.cpp b/src/test/unit/analyze/mcmc/rhat_basic_test.cpp index 4e15262000..5a09b585dd 100644 --- a/src/test/unit/analyze/mcmc/rhat_basic_test.cpp +++ b/src/test/unit/analyze/mcmc/rhat_basic_test.cpp @@ -40,6 +40,7 @@ class RhatBasic : public testing::Test { }; TEST_F(RhatBasic, test_basic_rhat) { + // computed via R pkg posterior double rhat_lp_basic_expect = 1.0001296; double rhat_theta_basic_expect = 1.0029197; @@ -51,9 +52,9 @@ TEST_F(RhatBasic, test_basic_rhat) { auto old_rhat_basic_theta = stan::analyze::compute_potential_scale_reduction(draws_theta, sizes); - EXPECT_NEAR(rhat_lp_basic_expect, rhat_basic_lp, 0.00001); - EXPECT_NEAR(rhat_theta_basic_expect, rhat_basic_theta, 0.00001); + EXPECT_NEAR(rhat_lp_basic_expect, rhat_basic_lp, 1e-5); + EXPECT_NEAR(rhat_theta_basic_expect, rhat_basic_theta, 1e-5); - EXPECT_NEAR(old_rhat_basic_lp, rhat_basic_lp, 0.00001); - EXPECT_NEAR(old_rhat_basic_theta, rhat_basic_theta, 0.00001); + EXPECT_NEAR(old_rhat_basic_lp, rhat_basic_lp, 1e-9); + EXPECT_NEAR(old_rhat_basic_theta, rhat_basic_theta, 1e-9); }