| autoplot.tariff_segments | R Documentation |
Plot the smooth effect estimated by risk_factor_gam() or inspect that same
effect together with candidate boundaries returned by
derive_tariff_segments(). Both methods use the same curve, confidence
interval, observation and axis layers.
## S3 method for class 'tariff_segments'
autoplot(
object,
confidence = FALSE,
color_gam = "steelblue",
show_observations = FALSE,
color_splits = "grey50",
size_points = 1,
color_points = "black",
rotate_labels = FALSE,
remove_outliers = NULL,
conf_int = NULL,
x_stepsize = NULL,
show_segments = TRUE,
...
)
## S3 method for class 'riskfactor_gam'
autoplot(
object,
confidence = FALSE,
color_gam = "steelblue",
show_observations = FALSE,
x_stepsize = NULL,
size_points = 1,
color_points = "black",
rotate_labels = FALSE,
remove_outliers = NULL,
conf_int = NULL,
...
)
object |
An object returned by |
confidence |
Logical. If |
color_gam |
Colour for the fitted GAM line. |
show_observations |
Logical. If |
color_splits |
Colour for segment boundaries. Used only for a
|
size_points |
Numeric point size for observed experience. |
color_points |
Colour for observed experience. |
rotate_labels |
Logical. If |
remove_outliers |
Optional single numeric upper display limit for observed points. The fitted curve remains unchanged. |
conf_int |
Deprecated. Use |
x_stepsize |
Optional positive numeric step size for x-axis tick marks.
If |
show_segments |
Logical. For a |
... |
Additional arguments reserved for method compatibility. |
The fitted line is shown on its natural response scale: claim frequency, average severity or risk premium. Optional observed points represent portfolio experience aggregated at the continuous risk-factor values used for fitting.
For a tariff_segments object, vertical lines show the derived interval
boundaries. These lines support actuarial review of where the continuous
effect changes sufficiently to motivate a categorical tariff treatment.
Set show_segments = FALSE to inspect only the underlying smooth curve.
Confidence intervals describe uncertainty in the fitted curve conditional on the selected GAM specification. They do not include uncertainty from model selection, omitted risk factors or future portfolio changes. Segment boundaries do not by themselves demonstrate that adjacent segments are statistically or commercially distinct. Exposure, claim volume, temporal stability and operational tariff constraints should be considered separately.
remove_outliers affects displayed observed points only. It does not remove
observations from the fitted GAM or alter the prediction curve or segment
boundaries.
A ggplot2 object.
Martin Haringa
risk_factor_gam(), derive_tariff_segments(),
add_tariff_segments()
## Not run:
fit <- risk_factor_gam(
MTPL,
risk_factor = "age_policyholder",
claim_count = "nclaims",
exposure = "exposure"
)
# Inspect the continuous effect before deriving tariff segments.
autoplot(fit, confidence = TRUE, show_observations = TRUE)
segments <- derive_tariff_segments(
fit,
segmentation_penalty = 10,
seed = 1
)
# Inspect the same effect with the candidate segment boundaries.
autoplot(segments, confidence = TRUE, show_observations = TRUE)
autoplot(segments, show_segments = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.