| plot_g_function | R Documentation |
Creates a contribution plot for a specific g-function group. For degree-1 groups (single variable), produces a 2D scatter + piecewise-linear plot with slope labels and knot markers. For degree-2 groups (two variables), produces a 3D surface plot using plotly if available, or a filled contour plot.
plot_g_function(earth_result, group_index, response_idx = NULL)
earth_result |
An object of class |
group_index |
Integer. Index of the g-function group (1-based, from
|
response_idx |
Integer or |
A ggplot2::ggplot object for d <= 1, or a plotly widget for d >= 2 (when plotly is installed). Falls back to ggplot2 contour if plotly is not available.
result <- fit_earth(mtcars, "mpg", c("cyl", "disp", "hp", "wt"))
plot_g_function(result, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.