Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

R2

R square


Description

The R2 measure of determination for linear models

Usage

R2(object,...)
## S3 method for class 'lm'
R2(object,...,adjust=TRUE,ref=0)
## Default S3 method:
R2(object,...,ref=0)

Arguments

object

a statistical model

...

further not yet used parameters

adjust

Logical, whether the estimate of R2 should be adjusted for the degrees of freedom of the model.

ref

A reference model for computation of a relative R^2.

Details

The R^2 measure of determination is defined as:

1-var(residuals)/var(data)

and provides the portion of variance explained by the model. It is a number between 0 and 1, where 1 means the model perfectly explains the data and 0 means that the model has no better explanation of the data than a constant mean. In case of multivariate models metric variances are used.

If a reference model is given by ref, the variance of the residuals of that models rather than the variance of the data is used. The value of such a relative R^2 estimates how much of the residual variance is explained.

If adjust=TRUE the unbiased estiamators for the variances are used, to avoid the automatisme that a more parameters automatically lead to a higher R^2.

Value

The R2 measure of determination.

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

See Also

Examples

data(Orange)
R2(lm(circumference~age,data=Orange))
R2(lm(log(circumference)~log(age),data=Orange))

compositions

Compositional Data Analysis

v2.0-1
GPL (>= 2)
Authors
K. Gerald van den Boogaart <boogaart@hzdr.de>, Raimon Tolosana-Delgado, Matevz Bren
Initial release
2021-01-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.