Compute Bayesian R-squared from matrix of posterior replications
Source:R/stan_misc.R
compute_rsquared.Rd
The function returns a global estimate rather than an estimate for each sample, since the predictive means and residual variance are estimated from replications instead of being computed on a per-sample basis.
References
Gelman, A. et al. (2019) "R-squared for Bayesian Regression Models", The American Statistician, 73(3), pp. 307–309. doi:10.1080/00031305.2018.1549100 .