code: def splitrhat(sim, n):
      
      try:
          rhat = _chains.split_potential_scale_reduction(sim, n)
      except (ValueError, ZeroDivisionError):
          rhat = nan
      return rhat
docs: Calculate rhat
  
      Parameters
      ----------
      sim : chains
      n : int
          Parameter index starting from 0