plot_contribution: Plot variable contribution

View source: R/plot_results.R

plot_contributionR Documentation

Plot variable contribution

Description

Creates a scatter plot showing each variable's actual contribution to the prediction. For each observation, the contribution is the sum of coefficient * basis function value across all terms involving that variable.

Usage

plot_contribution(earth_result, variable, 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.

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_contribution(result, "wt")


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