Learn R Programming

miscTools (version 0.6-28)

rSquared: Calculate R squared value

Description

Calculate R squared value.

Usage

rSquared( y, resid )

Arguments

y

vector of endogenous variables

resid

vector of residuals

Author

Arne Henningsen

Examples

Run this code
   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

Run the code above in your browser using DataLab