rSquared {miscTools}R Documentation

Calculate R squared value

Description

Calculate R squared value.

Usage

rSquared( y, resid )

Arguments

y

vector of endogenous variables

resid

vector of residuals

Author(s)

Arne Henningsen

Examples

   data( "Electricity", package = "Ecdat" )
   reg <- lm( cost ~ q + pl + pk + pf, Electricity )
   rSquared( Electricity$cost, reg$residuals )
   summary( reg )$r.squared  # returns the same value

[Package miscTools version 0.6-28 Index]