Calculates an R-hat (potential scale reduction factor) value.
Usage
# S3 method for class 'mcmcrs'
rhat(x, by = "all", as_df = FALSE, na_rm = FALSE, bound = FALSE, ...)
Arguments
- x
An object.
- by
A string indicating whether to determine by "term", "parameter" or "all".
- as_df
A flag indicating whether to return the results as a data frame versus a named list.
- na_rm
A flag specifying whether to ignore missing values.
- bound
flag specifying whether to bind mcmcrs objects by their chains before calculating rhat.
- ...
Other arguments passed to methods.
References
Gelman, A., and Rubin, D.B. 1992. Inference from Iterative Simulation Using Multiple Sequences. Statistical Science 7(4): 457–472.
See also
Other convergence:
converged()
,
converged_pars()
,
converged_terms()
,
esr()
,
esr_pars()
,
esr_terms()
,
rhat_pars()
,
rhat_terms()
Examples
rhat(mcmcrs(mcmcr_example, mcmcr_example))
#> $mcmcr1
#> [1] 2.002
#>
#> $mcmcr2
#> [1] 2.002
#>
rhat(mcmcrs(mcmcr_example, mcmcr_example), bound = TRUE)
#> Warning: `rhat.mcmcrs(x, bound = TRUE)` returns scalar was deprecated in mcmcr
#> 0.6.1.9001.
#> ℹ Please use `rhat(x, bound = TRUE)$bound` for previous behaviour instead.
#> ℹ `rhat.mcmcrs(bound = TRUE)` now returns named list of scalars.
#> $mcmcr1
#> [1] 2.002
#>
#> $mcmcr2
#> [1] 2.002
#>
#> $bound
#> [1] 1.891
#>