Generic Method to Calculate R2 for Fitted Model
Usage
r2(m, ...)
# S3 method for class 'pibblefit'
r2(m, covariates = NULL, ...)
# S3 method for class 'bassetfit'
r2(m, covariates = NULL, components = NULL, ...)
Arguments
- m
model object
- ...
other arguments to pass
- covariates
vector of indices for covariates to include in calculation of R2 (default:NULL means include all covariates by default). When non-null, all covariates not specified are set to zero for prediction.
- components
vector of indices for components of the GP model to include in the calculation of R2, i.e. which elements in the list of Theta/Gamma should be used for calculating R2 (default:NULL means to include all components by default). When non-null, all components not specified are removed for prediction.
Details
Calculates Posterior over Linear Model R2 as: $$1-\frac{SS_{res}}{SS_{tot}}$$ where \(SS\) is defined in terms of trace of variances
Method of calculating R2 is multivariate version of the Bayesian R2 proposed by Gelman, Goodrich, Gabry, and Vehtari, 2019
Calculates Posterior over Basset Model R2 as: $$1-\frac{SS_{res}}{SS_tot}$$
Method of calculating R2 is multivariate version of the Bayesian R2 proposed by Gelman, Goodrich, Gabry, and Vehtari, 2019