R/R2.R

Defines functions R2

Documented in R2

R2 <- function(model) {
    if (!any(class(model)=="lm")) stop("model must be class ``lm'' or ``glm''")
    yhat <- fitted(model)
    ehat <- residuals(model)
    y <- yhat + ehat
    cor(yhat,y)^2
}  

Try the SMIR package in your browser

Any scripts or data that you put into this service are public.

SMIR documentation built on May 29, 2017, 10:39 a.m.