Calculates the Accumulated Local Effects (ALE) from a given data.frame, model, predictions, and covariate. This riffs on the ALEPlot function available in the ALEPlot package.
ALE_fn(X, X.model, pred.fun, J, K = 40, type = "response", multi = FALSE)
the data.frame to get the covariate from
the name of the response variable
a function to calculate new predictions from the model
the column index of the covariate of interest
an integer value that determines the number of "windows" or breaks to calculate the model predictions over. More increase computational time but serves smooths the ALE predictions.
is either (response) or (prob) from predict.randomForest; if (prob) then n sets of predictions are returned for the n levels in var- if "response" then the factorized predicted response values are returned
is a logical for either multivariate factor as the response variable (TRUE) or not (FALSE- the default)
A list that contains:
K: the number of realized breaks
x.values: the break values trialed
class: the class of the covariate
quantile: the quantile of the breaks
fJ: the ALEs evaluated at a given x value