View source: R/model_refinement.R
| prepare_refinement | R Documentation |
Start a refinement workflow for a fitted GLM. Refinement steps such as
smoothing, restrictions and expert-based relativities can be added
sequentially and are only applied once refit() is called.
prepare_refinement(model, data = NULL)
model |
Object of class |
data |
Optional data.frame containing exactly the observations retained
in the fitted GLM and all required model variables. If model fitting omitted
rows because of missing values, supply the retained model data rather than
the original unfiltered data. If |
prepare_refinement() creates a persistent refinement specification. This
object contains the original GLM, the corresponding model data and the
ordered smoothing, restriction and relativity steps. It is the object that
should be retained and edited during actuarial review.
refit() applies the stored specification and returns a fitted GLM for model
diagnostics, prediction and tariff reporting. The returned GLM is a result,
not an editable refinement specification. Functions such as
add_smoothing(), edit_smoothing(), add_restriction() and
add_relativities() therefore accept a rating_refinement object and do not
accept an ordinary or refitted GLM directly.
A practical iterative workflow keeps both objects:
refinement <- prepare_refinement(model) |> add_smoothing(...) fitted_model <- refit(refinement) refinement <- refinement |> edit_smoothing(...) fitted_model <- refit(refinement)
prepare_refinement() is normally required only once for such an iteration.
Calling it on a model returned by refit() deliberately starts a new
refinement workflow with the already refined model as its baseline; it does
not recover the earlier smoothing or restriction steps for further editing.
Object of class rating_refinement. Retain this object when
refinement steps may need to be reviewed or edited after fitting.
add_smoothing(), edit_smoothing(), add_restriction(),
add_relativities(), refit()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.