When calculating second-order (2D) ALE statistics, there is no difficulty if both variables are categorical. The regular formulas for ALE operate normally. However, if one or both variables is numeric, the calculation is complicated by the necessity to determine the ALE midpoints between the ALE bin ceilings of the numeric variables. This function calculates these ALE midpoints for the numeric variables and resets the ALE bins to these values. The ALE values for ordinal ordinal variables are not changed. As part of the adjustment, the lowest numeric bin is merged into the second: the ALE values are completely deleted (since they do not represent a midpoint) and their counts are added to the first true bin.
Arguments
- ale_data
dataframe. ALE data
- x_cols
character. Names of the x columns in
ale_data
.- x_types
character same length as
x_cols
. Variable types (output ofvar_type()
) of correspondingx_cols
.- y_vals
See documentation for
ale_stats()
- ale_y_norm_fun
See documentation for
ale_stats()
Value
Same as ale_stats()
.
Details
After these possible adjustments, the ALE y values and bin counts are passed to ale_stats()
, which calculates their statistics as an ordinal variable since the numeric variables have thus been discretized.
Not exported.