partial_effects()

Plot partial effects with confidence bands for each smooth term.

Usage

Source

partial_effects(
    model,
    *,
    n_points=200,
    level=0.95,
)

For univariate s() terms, produces a line plot with a shaded confidence band. For bivariate te() and ti() terms, produces a heatmap of the partial effect with a companion SE panel.

Parameters

model: GAM

A fitted GAM.

n_points: int = 200

Number of evenly spaced points at which to evaluate each smooth. For 2-D smooths, the grid has approximately sqrt(n_points) points per side.

level: float = 0.95
Confidence level for the bands (the default is 0.95 -> ±1.96 SE).

Returns

altair.VConcatChart or altair.Chart
One panel per smooth term (two for 2-D smooths), vertically concatenated.