plot_partial_dependence: Plot partial dependence

View source: R/plot_results.R

plot_partial_dependenceR Documentation

Plot partial dependence

Description

Creates a partial dependence plot for a selected variable from a fitted earth model.

Usage

plot_partial_dependence(
  earth_result,
  variable,
  n_grid = 50L,
  response_idx = NULL
)

Arguments

earth_result

An object of class "earthUI_result" as returned by fit_earth().

variable

Character string. Name of the predictor variable to plot.

n_grid

Integer. Number of grid points for the partial dependence calculation. Default is 50.

response_idx

Integer or NULL. For multivariate models, which response column to plot (1-based). Default NULL uses the first response.

Value

A ggplot2::ggplot object.

Examples


result <- fit_earth(mtcars, "mpg", c("cyl", "disp", "hp", "wt"))
plot_partial_dependence(result, "wt")


earthUI documentation built on March 26, 2026, 1:07 a.m.