This generic function calculates the squared multiple correlation, or 'proportion variance explained', according to the formula
R^2 = 1 - SS(obj)/SS(tot)
, where SS(obj) = sum (y - pred(y))^2 is the squared error of predictions pred(y), and SS(tot) = sum (y - mean(y))^2 the total sum of squares.
An object of a suitable class for the R-Squared to be
calculated - an object with a predict method, and if y is missing, a slot
Some methods for this generic function accept an argument y, providing the observed data. At present, no other additional arguments are used
Returns a numeric value with the corresponding R-Squared.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.