RSS <- function(model){ sum(residuals(model)^2) } dydx <- function(x, model, variable, ...){ }