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

r.squared

R squared and adjusted R squared for panel models


Description

This function computes R squared or adjusted R squared for plm objects. It allows to define on which transformation of the data the (adjusted) R squared is to be computed and which method for calculation is used.

Usage

r.squared(object, model = NULL, type = c("cor", "rss", "ess"), dfcor = FALSE)

Arguments

object

an object of class "plm",

model

on which transformation of the data the R-squared is to be computed. If NULL, the transformation used to estimate the model is also used for the computation of R squared,

type

indicates method which is used to compute R squared. One of
"rss" (residual sum of squares),
"ess" (explained sum of squares), or
"cor" (coefficient of correlation between the fitted values and the response),

dfcor

if TRUE, the adjusted R squared is computed.

Value

A numerical value. The R squared or adjusted R squared of the model estimated on the transformed data, e. g. for the within model the so called "within R squared".

See Also

plm() for estimation of various models; summary.plm() which makes use of r.squared.

Examples

data("Grunfeld", package = "plm")
p <- plm(inv ~ value + capital, data = Grunfeld, model = "pooling")
r.squared(p)
r.squared(p, dfcor = TRUE)

plm

Linear Models for Panel Data

v2.4-1
GPL (>= 2)
Authors
Yves Croissant [aut, cre], Giovanni Millo [aut], Kevin Tappe [aut], Ott Toomet [ctb], Christian Kleiber [ctb], Achim Zeileis [ctb], Arne Henningsen [ctb], Liviu Andronic [ctb], Nina Schoenfelder [ctb]
Initial release
2021-03-02

We don't support your browser anymore

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