docstr: Confirm R-hat statistic is close to 1 for a large
  number of samples. Also checks the correct shape
code: def test_rhat(self, data, var_names, method):
      """Confirm R-hat statistic is close to 1 for a large
      number of samples. Also checks the correct shape"""
      rhat_data = rhat(data, var_names=var_names, method=method)
      for r_hat in rhat_data.data_vars.values():
          assert (
              (1 / GOOD_RHAT < r_hat.values)
              | (r_hat.values < GOOD_RHAT)
          ).all()
  
      # In None case check that all varnames from rhat_data match input data
      if var_names is None:
          assert list(rhat_data.data_vars) == list(data.data_vars)
  
imports: import os
  import numpy
  import packaging
  import pandas
  import pytest
  import scipy
  from numpy.testing import assert_almost_equal
  from ...data import from_cmdstan, load_arviz_data
  from ...rcparams import rcParams
  from ...sel_utils import xarray_var_iter
  from ...stats import bfmi, ess, mcse, rhat
  from ...stats.diagnostics import _ess, _ess_quantile, _mc_error, _mcse_quantile, _multichain_statistics, _rhat, _rhat_rank, _split_chains, _z_scale, ks_summary
label_desc: Use image node_id 6 for calling the TestDiagnostics obj's underlying member method code with example usage: obj.test_rhat(data, var_names, method) without return types