plot.ice {ICEbox} | R Documentation |
Plotting of ice
objects.
Description
Plotting of ice
objects.
Usage
## S3 method for class 'ice'
plot(x, plot_margin = 0.05, frac_to_plot = 1,
plot_points_indices = NULL, plot_orig_pts_preds = TRUE,
pts_preds_size = 1.5, colorvec, color_by = NULL,
x_quantile = TRUE, plot_pdp = TRUE,
centered = FALSE, prop_range_y = TRUE,
rug_quantile = seq(from = 0, to = 1, by = 0.1),
centered_percentile = 0,
point_labels = NULL, point_labels_size = NULL,
prop_type,...)
Arguments
x |
Object of class |
plot_margin |
Extra margin to pass to |
frac_to_plot |
If |
plot_points_indices |
If not |
plot_orig_pts_preds |
If |
pts_preds_size |
Size of points to make if |
colorvec |
Optional vector of colors to use for each curve. |
color_by |
Optional variable name in |
x_quantile |
If |
plot_pdp |
If |
centered |
If |
prop_range_y |
When |
centered_percentile |
The percentile of |
point_labels |
If not |
point_labels_size |
If not |
rug_quantile |
If not |
prop_type |
Scaling factor for the right vertical axis in centered plots if |
... |
Other arguments to be passed to the |
Value
A list with the following elements.
plot_points_indices |
Row numbers of |
legend_text |
If the |
See Also
ice
Examples
## Not run:
require(ICEbox)
require(randomForest)
require(MASS) #has Boston Housing data, Pima
data(Boston) #Boston Housing data
X = Boston
y = X$medv
X$medv = NULL
## build a RF:
bhd_rf_mod = randomForest(X, y)
## Create an 'ice' object for the predictor "age":
bhd.ice = ice(object = bhd_rf_mod, X = X, y = y, predictor = "age",
frac_to_build = .1)
## plot
plot(bhd.ice, x_quantile = TRUE, plot_pdp = TRUE, frac_to_plot = 1)
## centered plot
plot(bhd.ice, x_quantile = TRUE, plot_pdp = TRUE, frac_to_plot = 1,
centered = TRUE)
## color the curves by high and low values of 'rm'.
# First create an indicator variable which is 1 if the number of
# rooms is greater than the median:
median_rm = median(X$rm)
bhd.ice$Xice$I_rm = ifelse(bhd.ice$Xice$rm > median_rm, 1, 0)
plot(bhd.ice, frac_to_plot = 1, centered = TRUE, prop_range_y = TRUE,
x_quantile = T, plot_orig_pts_preds = T, color_by = "I_rm")
bhd.ice = ice(object = bhd_rf_mod, X = X, y = y, predictor = "age",
frac_to_build = 1)
plot(bhd.ice, frac_to_plot = 1, centered = TRUE, prop_range_y = TRUE,
x_quantile = T, plot_orig_pts_preds = T, color_by = y)
## End(Not run)