Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
Naming mistake during implementation - assumed the "M" in "MAD" was "max". Wrong - it's "median".
Description:
The name of this function is inaccurate. The code shows what's going on:
/**
* Compute maximum 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,
* a scale factor for asymptotically normal consistency: `1/qnorm(3/4)`.
* (R stats version 3.6.2)
*
* @param index parameter index
* @return sample mad
*/
double max_abs_deviation(const int index) const {
Eigen::MatrixXd draws = samples(index);
auto center = median(index);
Eigen::MatrixXd abs_dev = (draws.array() - center).abs();
Eigen::Map<Eigen::VectorXd> map(abs_dev.data(), abs_dev.size());
return 1.4826 * stan::math::quantile(map, 0.5);
}
fixing this requires changing the function name (everywhere, including CmdStan's stansummary utility) and the docstring.
it won't actually change the code. worth doing before the release?
Summary:
Naming mistake during implementation - assumed the "M" in "MAD" was "max". Wrong - it's "median".
Description:
The name of this function is inaccurate. The code shows what's going on:
Current Version:
v2.35.0