add_smoothing() stores a smoothing specification on a
rating_refinement object. It does not alter the fitted GLM immediately.
The smoothing is evaluated in the recorded step order and applied when
refit() is called.
The original GLM contains model_variable, usually a factor created by
grouping a continuous risk factor. source_variable identifies the original
numeric variable represented by those groups.
The smoother is estimated from the fitted GLM relativities at the midpoint of
each model interval. Consequently, the amount of information available to
the smoother is primarily determined by the number of grouped model levels,
rather than by the number of individual portfolio records. Exposure or
another volume measure can be supplied through weights so that model levels
with more portfolio volume have greater influence on the fitted curve.
The fitted curve is evaluated using breaks and converted back to a grouped
tariff variable. The original model term is replaced by that smoothed tariff
variable during refitting.
Actuarial interpretation
Smoothing introduces a structural assumption: adjacent values of the source
variable are expected to have related tariff effects. The selected method,
basis dimension and breaks should therefore be assessed against exposure,
observed experience, coefficient uncertainty and stability over time. A
smooth curve should not be interpreted as evidence that the underlying risk
relationship is itself known without uncertainty.
Smoothing methods
The available methods represent different assumptions about the shape of the
tariff effect:
"spline"
The general-purpose default. Fits an unconstrained
penalized cubic regression spline. It is suitable when the tariff effect
should be smooth but no monotonicity or curvature restriction is
justified.
"poly"
Fits a global polynomial through the grouped GLM
relativities. degree determines its order. A low degree gives a compact
parametric trend; higher degrees can follow more local variation but may
oscillate, particularly near the boundaries.
"increasing" and "decreasing"
Fit monotone smooths. These
methods constrain the tariff effect to move in one direction, without
imposing how quickly its slope changes. They are often the most directly
interpretable constrained specifications when actuarial reasoning supports
a consistently increasing or decreasing risk effect.
"convex" and "concave"
Constrain curvature but not direction.
For a convex curve, the slope increases as the source variable increases;
for a concave curve, the slope decreases. A convex curve may therefore be
U-shaped and a concave curve may be inverted U-shaped. These are advanced
choices when curvature itself has a defensible interpretation.
"increasing_convex" and "increasing_concave"
Fit increasing
curves with an additional curvature constraint. An increasing convex
effect rises at an increasing rate, for example when upper-tail risk causes
marginal cost to accelerate. An increasing concave effect rises at a
decreasing rate and gradually flattens, for example when risk cost rises
with insured value but less than proportionally.
"decreasing_convex" and "decreasing_concave"
Fit decreasing
curves with an additional curvature constraint. A decreasing convex effect
becomes less steep and tends to flatten. A decreasing concave effect
becomes progressively steeper.
"gam"
Fits an unconstrained thin-plate regression spline with
mgcv::gam(). It is mainly intended as a flexible reference when comparing
the general spline and shape-constrained specifications. It does not impose
the actuarial shape assumptions represented by the constrained methods.
The shape-constrained methods are fitted with scam::scam(). Monotonicity
concerns the direction of the effect, whereas convexity and concavity concern
how its slope changes. In most tariff applications, a directional assumption
is easier to substantiate than a curvature assumption. A constraint
should reflect an actuarial or pricing assumption that is defensible for the
risk factor; it should not be selected solely because it produces a smoother
visual result. The combined monotonicity and curvature methods are advanced
specifications and are most appropriate when both assumptions can be
supported independently.
The former short codes "mpi", "mpd", "cx", "cv", "micx",
"micv", "mdcx" and "mdcv" remain accepted as compatibility aliases.
New code should use the readable method names above. Both forms produce the
same smoothing specification.
Basis dimension and polynomial degree
For "spline", "gam" and the shape-constrained methods, k specifies the
basis dimension. It controls the maximum flexibility available to the smooth,
but it is not the final effective degrees of freedom of the fitted curve.
The estimated smoothing penalty can reduce the effective degrees of freedom
below this maximum.
A smaller k restricts the curve to broad movements. A larger k permits
more local variation, but requires enough distinct grouped covariate values
and may be unstable when only a few tariff levels are available. If k is
NULL, the function uses the smaller of 10 and the number of unique grouped
model points. Spline, GAM and shape-constrained smoothing require at least
three unique grouped values. The function checks this dimension before
fitting and reports the observed number of unique values when the requested
complexity is not feasible.
For "poly", degree has the corresponding complexity role. A polynomial
of degree \(d\) requires at least \(d + 1\) unique grouped values. When
degree is omitted, the existing behaviour uses the highest degree supported
by the grouped model points. In practice, an explicit low degree is generally
preferable when a stable global trend is intended.
degree is only accepted for smoothing = "poly". Conversely, k is only
accepted for "spline", "gam" and the shape-constrained methods. This
separation prevents a complexity argument from being supplied but silently
ignored.
The deprecated smooth_coef() wrapper remains available for backwards
compatibility.