cm {actuar} | R Documentation |
Fit the following credibility models: Bühlmann, Bühlmann-Straub, hierarchical or regression (Hachemeister).
cm(formula, data, ratios, weights, subset, regformula = NULL, regdata, adj.intercept = FALSE, method = c("Buhlmann-Gisler", "Ohlsson", "iterative"), tol = sqrt(.Machine$double.eps), maxit = 100, echo = FALSE) ## S3 method for class 'cm': print(x, ...) ## S3 method for class 'cm': predict(object, levels = NULL, newdata, ...) ## S3 method for class 'cm': summary(object, levels = NULL, newdata, ...) ## S3 method for class 'summary.cm': print(x, ...)
formula |
an object of class "formula" : a symbolic
description of the model to be fit. The details of model
specification are given below. |
data |
a matrix or a data frame containing the portfolio structure, the ratios or claim amounts and their associated weights, if any. |
ratios |
expression indicating the columns of data
containing the ratios or claim amounts. |
weights |
expression indicating the columns of data
containing the weights associated with ratios . |
subset |
an optional logical expression indicating a subset of observations to be used in the modeling process. All observations are included by default. |
regformula |
an object of class "formula" : symbolic
description of the regression component (see "lm" for
details). No left hand side is needed in the formula; if present it
is ignored. If NULL , no regression is done on the data. |
regdata |
an optional data frame, list or environment (or object
coercible by as.data.frame to a data frame) containing
the variables in the regression model. |
adj.intercept |
if TRUE , the intercept of the regression
model is located at the barycenter of the regressor instead of the
origin. |
method |
estimation method for the variance components of the model; see details below. |
tol |
tolerance level for the stopping criteria for iterative estimation method. |
maxit |
maximum number of iterations in iterative estimation method. |
echo |
logical; whether to echo the iterative procedure or not |
x, object |
an object of class "cm" |
levels |
character vector indicating the levels to predict or to
include in the summary; if NULL all levels are included. |
newdata |
data frame containing the variables used to predict credibility regression models. |
... |
additional attributes to attach to the result for the
predict and summary methods; further arguments to
format for the print.summary method;
unused for the print method. |
cm
is the unified front end for credibility models fitting.
Currently, the function supports hierarchical models with any number
of levels (with Bühlmann and
Bühlmann-Straub models as special cases) and the
regression model of Hachemeister. Usage of cm
is similar to
lm
.
The formula
argument symbolically describes the structure of
the portfolio in the form ~ terms. Each term is an interaction
between risk factors contributing to the total variance of the
portfolio data. Terms are separated by +
operators and
interactions within each term by :
. For a portfolio divided
first into sectors, then units and finally contracts, formula
would be ~ sector + sector:unit + sector:unit:contract, where
sector
, unit
and contract
are column names in
data
. In general, the formula should be of the form ~ a +
a:b + a:b:c + a:b:c:d + ....
If argument regformula
is not NULL
, the regression model
of Hachemeister is fit to the data. The response is usually time. By
default, the intercept of the model is located at time origin. If
argument adj.intercept
is TRUE
, the intercept is moved
to the (collective) barycenter of time, by orthogonalization of the
design matrix. Note that the regression coefficients may be difficult
to interpret in this case.
Arguments ratios
, weights
and subset
are used
like arguments select
, select
and subset
,
respectively, of function subset
.
Data does not have to be sorted by level. Nodes with no data (complete
lines of NA
except for the portfolio structure) are allowed,
with the restriction mentioned above.
Function cm
computes the structure parameters estimators of the
model specified in formula
. The value returned is an object of
class cm
.
An object of class "cm"
is a list with at least the following
components:
means |
a list containing, for each level, the vector of linearly sufficient statistics. |
weights |
a list containing, for each level, the vector of total weights. |
unbiased |
a vector containing the unbiased variance components
estimators, or NULL . |
iterative |
a vector containing the iterative variance components
estimators, or NULL . |
cred |
for multi-level hierarchical models: a list containing, the vector of credibility factors for each level. For one-level models: an array or vector of credibility factors. |
nodes |
a list containing, for each level, the vector of the number of nodes in the level. |
classification |
the columns of data containing the
portfolio classification structure. |
ordering |
a list containing, for each level, the affiliation of a node to the node of the level above. |
adj.models |
a list containing, for each node, the credibility
adjusted regression model as obtained with
lm.fit or lm.wfit . |
transition |
if adj.intercept is TRUE , a transition
matrix from the basis of the orthogonal design matrix to the basis
of the original design matrix. |
terms |
the terms object used. |
The method of predict
for objects of class "cm"
computes
the credibility premiums for the nodes of every level included in
argument levels
(all by default). Result is a list the same
length as levels
or the number of levels in formula
, or
an atomic vector for one-level models.
The credibility premium at one level is a convex combination between the linearly sufficient statistic of a node and the credibility premium of the level above. (For the first level, the complement of credibility is given to the collective premium.) The linearly sufficient statistic of a node is the credibility weighted average of the data of the node, except at the last level, where natural weights are used. The credibility factor of node i is equal to
w[i]/(w[i] + a/b),
where w[i] is the weight of the node used in the linearly sufficient statistic, a is the average within node variance and b is the average between node variance.
The credibility premium of node i is equal to
y' ba[i],
where y is a matrix created from newdata
and
ba[i] is the vector of credibility adjusted regression
coefficients of node i. The latter is given by
ba[i] = Z[i] b[i] + (I - Z[i]) m,
where b[i] is the vector of regression coefficients based on data of node i only, m is the vector of collective regression coefficients, Z[i] is the credibility matrix and I is the identity matrix. The credibility matrix of node i is equal to
A^(-1) (A + s2 S[i]),
where S[i] is the unscaled regression covariance matrix of the node, s2 is the average within node variance and A is the within node covariance matrix.
If the intercept is positioned at the barycenter of time, matrices S[i] and A (and hence Z[i]) are diagonal. This amounts to use Bühlmann-Straub models for each regression coefficient.
Argument newdata
provides the “future” value of the
regressors for prediction purposes. It should be given as specified in
predict.lm
.
For hierarchical models, two sets of estimators of the variance components (other than the within node variance) are available: unbiased estimators and iterative estimators.
Unbiased estimators are based on sums of squares of the form
B[i] = sum(j; w[ij] (X[ij] - Xb[i])^2 - (J - 1) a)
and constants of the form
c[i] = w[i] - sum(j; w[ij]^2)/w[i],
where X[ij] is the linearly sufficient statistic of level (ij); Xb[i] is the weighted average of the latter using weights w[ij]; w[i] = sum(j; w[ij]); J is the effective number of nodes at level (ij); a is the within variance of this level. Weights w[ij] are the natural weights at the lowest level, the sum of the natural weights the next level and the sum of the credibility factors for all upper levels.
The Bühlmann-Gisler estimators (method =
"Buhlmann-Gisler"
) are given by
b = mean(max(B[i]/c[i], 0)),
that is the average of the per node variance estimators truncated at 0.
The Ohlsson estimators (method = "Ohlsson"
) are given by
b = sum(i; B[i]) / sum(i; c[i]),
that is the weighted average of the per node variance estimators without any truncation. Note that negative estimates will be truncated to zero for credibility factor calculations.
In the Bühlmann-Straub model, these estimators are equivalent.
Iterative estimators method = "iterative"
are pseudo-estimators
of the form
b = sum(i; w[i] * (X[i] - Xb)^2)/d,
where X[i] is the linearly sufficient statistic of one level, Xb is the linearly sufficient statistic of the level above and d is the effective number of nodes at one level minus the effective number of nodes of the level above. The Ohlsson estimators are used as starting values.
For regression models, with the intercept at time origin, only
iterative estimators are available. If method
is different from
"iterative"
, a warning is issued. With the intercept at the
barycenter of time, the choice of estimators is the same as in the
Bühlmann-Straub model.
Vincent Goulet vincent.goulet@act.ulaval.ca, Xavier Milhaud, Tommy Ouellet, Louis-Philippe Pouliot
Bühlmann, H. and Gisler, A. (2005), A course in credibility theory and its applications, Springer.
Goulet, V. (1998), Principles and Application of Credibility Theory, Journal of Actuarial Practice 6, ISSN 1064-6647.
Goovaerts, M. J. and Hoogstad, W. J. (1987), Credibility Theory, Surveys of Actuarial Studies, NO.4, Nationale-Nederlanden N.V.
subset
, formula
,
lm
, predict.lm
.
data(hachemeister) ## Buhlmann-Straub model fit <- cm(~state, hachemeister, ratios = ratio.1:ratio.12, weights = weight.1:weight.12) fit # print method predict(fit) # credibility premiums summary(fit) # more details ## Two-level hierarchical model. Notice that data does not have ## to be sorted by level X <- cbind(unit = c(1, 2, 1, 2, 2), hachemeister) fit <- cm(~unit + unit:state, X, ratio.1:ratio.12, weight.1:weight.12) predict(fit) predict(fit, levels = "unit") # unit credibility premiums only summary(fit) summary(fit, levels = "unit") # unit summaries only ## Regression model with intercept at time origin fit <- cm(~state, hachemeister, regformula = ~time, regdata = data.frame(time = 12:1), ratios = ratio.1:ratio.12, weights = weight.1:weight.12) fit predict(fit, newdata = data.frame(time = 0)) summary(fit, newdata = data.frame(time = 0)) ## Same regression model, with intercept at barycenter of time fit <- cm(~state, hachemeister, adj.intercept = TRUE, regformula = ~time, regdata = data.frame(time = 12:1), ratios = ratio.1:ratio.12, weights = weight.1:weight.12) fit predict(fit, newdata = data.frame(time = 0)) summary(fit, newdata = data.frame(time = 0))