From dad3486b8940550d60f8281137be1670dc31df7a Mon Sep 17 00:00:00 2001 From: Mitzi Morris Date: Thu, 28 Nov 2024 13:59:47 -0500 Subject: [PATCH] name fix --- src/stan/mcmc/chainset.hpp | 10 +++++----- src/test/unit/mcmc/chainset_test.cpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/stan/mcmc/chainset.hpp b/src/stan/mcmc/chainset.hpp index 9eb9369621..3ec11ea461 100644 --- a/src/stan/mcmc/chainset.hpp +++ b/src/stan/mcmc/chainset.hpp @@ -253,7 +253,7 @@ class chainset { double median(const std::string& name) const { return median(index(name)); } /** - * Compute maximum absolute deviation (mad) for specified parameter. + * Compute median absolute deviation (mad) for specified parameter. * * Follows R implementation: constant * median(abs(x - center)) * where the value of center is median(x) and the constant is 1.4826, @@ -263,7 +263,7 @@ class chainset { * @param index parameter index * @return sample mad */ - double max_abs_deviation(const int index) const { + double med_abs_deviation(const int index) const { Eigen::MatrixXd draws = samples(index); auto center = median(index); Eigen::MatrixXd abs_dev = (draws.array() - center).abs(); @@ -272,7 +272,7 @@ class chainset { } /** - * Compute maximum absolute deviation (mad) for specified parameter. + * Compute median absolute deviation (mad) for specified parameter. * * Follows R implementation: constant * median(abs(x - center)) * where the value of center is median(x) and the constant is 1.4826, @@ -282,8 +282,8 @@ class chainset { * @param name parameter name * @return sample mad */ - double max_abs_deviation(const std::string& name) const { - return max_abs_deviation(index(name)); + double med_abs_deviation(const std::string& name) const { + return med_abs_deviation(index(name)); } /** diff --git a/src/test/unit/mcmc/chainset_test.cpp b/src/test/unit/mcmc/chainset_test.cpp index 5647652485..93b92f0d2c 100644 --- a/src/test/unit/mcmc/chainset_test.cpp +++ b/src/test/unit/mcmc/chainset_test.cpp @@ -170,7 +170,7 @@ TEST_F(McmcChains, summary_stats) { EXPECT_NEAR(theta_sd_expect, bern_chains.sd("theta"), 1e-5); double theta_mad_expect = 0.12309; - EXPECT_NEAR(theta_mad_expect, bern_chains.max_abs_deviation("theta"), 1e-5); + EXPECT_NEAR(theta_mad_expect, bern_chains.med_abs_deviation("theta"), 1e-5); double theta_mcse_mean_expect = 0.003234; EXPECT_NEAR(theta_mcse_mean_expect, bern_chains.mcse_mean("theta"), 1e-4);