Description Usage Arguments Details Value Examples
Computes the R2 value
1 | r2(pred, truth)
|
pred |
a numeric vector of predicted/fitted values |
truth |
a numeric vector of true/observed values |
Uses 2 numeric vectors pred and truth to compute an R2 value
r2-value
1 2 3 4 5 | #using the ISLR::Credit database for this example
truth <- ISLR::Credit$Limit
reg_model <- lm(ISLR::Credit$Limit~ISLR::Credit$Income)
pred <- reg_model$fitted.values
r2(pred, truth)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.