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)
"print"(x, ...)
"predict"(object, levels = NULL, newdata, ...)
"summary"(object, levels = NULL, newdata, ...)
"print"(x, ...)
"formula"
: a
symbolic description of the model to be fit. The details of model
specification are given below.data
containing the ratios or claim amounts.data
containing the weights associated with ratios
.as.data.frame
to a data frame)
containing the variables in the regression model.TRUE
, the intercept of the regression
model is located at the barycenter of the regressor instead of the
origin."cm"
NULL
all levels are included.predict
and summary
methods; further arguments to
format
for the print.summary
method;
unused for the print
method.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:
NULL
.NULL
.data
containing the
portfolio classification structure.lm.fit
or lm.wfit
.adj.intercept
is TRUE
, a transition
matrix from the basis of the orthogonal design matrix to the basis
of the original design matrix.terms
object used.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.
newdata
and
$ba[i]$ is the vector of credibility adjusted regression
coefficients of node $i$. The latter is given by
$$b_i^a = 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 + s^2 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
.method =
"Buhlmann-Gisler"
) are given by
$$b = \frac{1}{I} \sum_i \max \left( \frac{B_i}{c_i}, 0
\right),$$
that is the average of the per node variance estimators truncated at
0. The Ohlsson estimators (method = "Ohlsson"
) are given by
$$b = \frac{\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 = \frac{1}{d} \sum_i w_i (X_i - \bar{X})^2,$$
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.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.
Belhadj, H., Goulet, V. and Ouellet, T. (2009), On parameter estimation in hierarchical credibility, Astin Bulletin 39.
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 <- data.frame(unit = c("A", "B", "A", "B", "B"), 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))
Run the code above in your browser using DataLab