r2.gelman: Calculate R squared (R2) for a multilevel/hierarchical model...

Description Usage Arguments Value Author(s) References See Also

Description

This function calculates the R-squared of a multilevel/hierarchical model following Gelman & Pardoe (2006) (see References).

Usage

1
r2.gelman(residuals, data.level, responsevar, param.sims)

Arguments

residuals

A numeric matrix containing the residual values obtained through MCMC.

data.level

Logical. If TRUE, calculates the R2 at the data level (level 1) and the denominator is the variance of the data instead of variance of the parameters/linear predictors (see function definition for more details).

responsevar

A numeric vector. The response variable used to fit the model. Only required for data-level calculations.

param.sims

A numeric matrix containing the posterior samples for the random effects parameters.

Value

A numeric value: the r-squared

Author(s)

Paco, based on code by Gelman & Hill (2007) (see references).

References

Gelman & Pardoe (2006) Technometrics. Gelman & Hill (2007) book

See Also

r2.multilevel in this same package.

r.squaredGLMM in MuMIn package and http://jslefche.wordpress.com/2013/03/13/r2-for-linear-mixed-effects-models/


Pakillo/pacotools documentation built on May 7, 2019, 11:56 p.m.