makeStandardAnnualInput {BALD} | R Documentation |
Create an Object of class StandardAnnualAggLossDevModelInput
.
makeStandardAnnualInput( incremental.payments=decumulate(cumulative.payments), extra.dev.years=1, extra.exp.years=1, non.stoch.inflation.rate=0, non.stoch.inflation.weight=1, stoch.inflation.rate=0, stoch.inflation.weight=1-non.stoch.inflation.weight, stoch.inflation.lower.bound=-1, stoch.inflation.upper.bound=Inf, known.stoch.inflation.mean=NA, known.stoch.inflation.persistence=NA, total.dev.years=extra.dev.years+dim(incremental.payments)[2], total.exp.years=extra.exp.years+dim(incremental.payments)[1], cumulative.payments=cumulate(incremental.payments), exp.year.type=c('ambiguous', 'py', 'ay'), prior.for.knot.locations=2, prior.for.number.of.knots=c(3, 1/7), use.skew.t=FALSE, bound.for.skewness.parameter=10, last.column.with.scale.innovation=dim(incremental.payments)[2], use.ar1.in.calendar.year=FALSE, use.ar1.in.exposure.growth=TRUE, projected.rate.of.decay=NA)
incremental.payments |
A square matrix of incremental payments. Row names must correspond to the exposure year. Only the upper-left (including the diagonal) of this matrix may have non-missing values. Lower-right must be |
extra.exp.years |
A single integer value ( |
extra.dev.years |
A single integer value ( |
non.stoch.inflation.rate |
May be one of three types (See Inflation Rate in Details): 1) A single numeric value; 2) a vector of numerics (of specific length); 3) a matrix of numerics (of specific dim). |
non.stoch.inflation.weight |
May be one of three types (See Inflation Rate in Details): 1) A single numeric value; 2) a vector of numerics (of specific length); 3) a matrix of numerics (of specific dim). |
stoch.inflation.rate |
May be one of two types (See Inflation Rate in Details): 1) A single numeric value of zero; 2) a vector of numerics (of specific length). |
stoch.inflation.weight |
May be one of three types (See Inflation Rate in Details): 1) A single numerical value; 2) a vector of numerics (of specific length); 3) a matrix of numerics (of specific dim). |
stoch.inflation.lower.bound |
May be one of three types (See Inflation Rate in Details): 1) A single numeric value; 2) a vector of numerics (of specific length); 3) a matrix of numerics (of specific dim). |
stoch.inflation.upper.bound |
May be one of three types (See Inflation Rate in Details): 1) A single numeric value; 2) a vector of numerics (of specific length); 3) a matrix of numerics (of specific dim). |
known.stoch.inflation.mean |
May be one of two types (See Inflation Rate in Details): 1) A single numeric value; 2) |
known.stoch.inflation.persistence |
May be one of two types (See Inflation Rate in Details): 1) A single numeric value; 2) |
total.exp.years |
A single integer value (overrides |
total.dev.years |
A single integer value (overrides |
cumulative.payments |
A numeric matrix with the same dim and dimnames as |
exp.year.type |
A single character value indicating the type of exposure years: ‘ambiguous’, ‘py’, and ‘ay’ mean ‘Exposure Year’, ‘Policy Year’, and ‘Accident Year’; respectively. |
prior.for.knot.locations |
A single numeric value of at least 1. The prior for the location of knots is a scaled beta with parameters |
prior.for.number.of.knots |
A two element vector giving the paramters for the prior number of knots. (See Number of Knots in Details) |
use.skew.t |
A logical value. If |
bound.for.skewness.parameter |
A positive numerical value representing the symetric boundaries for the skewness parameter. In most cases, the default should be sufficient. Ignored if |
last.column.with.scale.innovation |
A single integer. Must be at least 1 and at most the number of columns in |
use.ar1.in.calendar.year |
A logical value. The calendar year effect errors may (at the users discretion) include an autoregressive process of order 1. |
use.ar1.in.exposure.growth |
A logical value. The exposure growth errors may (at the users discretion) include an autoregressive process of order 1. |
projected.rate.of.decay |
May be one of three types (See Projected Rate of Decay in Details): 1) |
The loss development models require extensive input. Much of the input is directly dependent on the values of other input. As such, this function facilitates much of the work of setting model parameters and determining which output to collect.
The function creates an object of class StandardAnnualAggLossDevModelInput
.
Workers Compensation indemnity statutes can be extremely complex. In order to provide a sufficient level of flexibility, the model allows for a combination for 3 inflation/escalation rates: one non-stochastic rate, one stochastic rate, and one zero rate. All inflation rates are on the real scale, that is, a 5 percent increase is entered as “0.05.” Inflation rates are only used to create an expected inflation rate. Actual calendar year effects deviate from this prior along the diagional.
The user must specify a non-stochastic rate of inflation for all observed and future time periods. Assuming a non-stochastic inflation rate of zero turns this feature off.
non.stoch.inflation.rate
The non-stochastic inflation rate is specified by the parameter non.stoch.inflation.rate
.
The default value is set to “0.”
There are three possible ways to specify non.stoch.inflation.rate
:
The inflation in every cell is assumed to be this value. For instance, choosing zero results in no non-stochastic inflation rate.
Its length must be two less than total.exp.years + total.dev.years
and must have names
starting at dimnames(incremental.payments) [[1]][2]
and increasing by one.
The first value corresponds to the inflation rate from the first to second diagonal (or cell 1,1 to cells 1,2 and 2,1).
The second value corresponds to the inflation rate from the second to third diagonal. etc.
It must have number of rows equal to total.exp.years
and number of columns equal to total.dev.years
.
The row names must be equal to the row names of incremental.payments
.
Each cell represents the inflation to that cell.
Cells in the first column represent inflation down rows.
Cells in other columns represent inflation from left to right.
Cell 1,1 is ignored.
non.stoch.inflation.weight
The user has the option of allowing the percentage of dollars that inflate/escalate at the non-stochastic rate to vary.
This is done by properly setting the value of non.stoch.inflation.weight
.
The default value is set to “1.”
non.stoch.inflation.weight
must be at least zero and at most one. Also non.stoch.inflation.weight + stoch.inflation.weight
must be at most one.
There are three possible ways to specify non.stoch.inflation.weight
:
The proportion of dollars that inflate at the rate of non.stoch.inflatoin.rate
in every cell is assumed to be this value.
For instance, choosing zero results in the model assuming that no non-stochastic inflation applies.
Its length must be total.dev.years
.
This vector is repeated to produce a matrix such that each row equals this vector.
This matrix is then assumed to be the supplied for this parameter (See below).
See next item.
It must have number of rows equal to total.exp.years
and number of columns equal to total.dev.years
.
The row names must be equal to the row names of incremental.payments
.
Each cell represents the proportion of dollars in the previous cell inflating at the non.stoch.inflation.rate
rate to that cell.
Cells in the first column represent inflation down rows.
Cells in other columns represent inflation from left to right.
Cell 1,1 is ignored.
The stochastic inflation rate is modeled as an AR1 process (on the log scale).
The user must supply a stochastic rate of inflation for at least all observed diagonals and has the option of supplying values for diagonals beyond the final diagonal in the observed triangle.
As such, the stochasticity of the stochastic rate of inflation only applies to future rates of inflation.
Values not supplied for future diagonals are predicted using the estimated parameters for the supplied inflation series.
If the user does not wish to supply/assume a stochastic rate of inflation, he may set the stochastic inflation rate to zero for all periods
(stoch.inflation.rate=0
).
stoch.inflation.rate
The stochastic inflation rate is specified by the parameter stoch.inflation.rate
.
The default value is set to “0.”
There are two possible ways to specify stoch.inflation.rate
:
It is assumed that no stochastic inflation applies.
Its length must be at least one less than the number of rows in incremental.payments
.
Future values are simulated as needed.
(No element in stoch.inflation.rate
may be NA
; only supply values for known rates of inflation.)
The vector must be named and the names must be consecutive integers.
The names must contain the second and last values of dimnames(incremental.payments)[[1]]
.
The names represent the calendar year of inflation.
stoch.inflation.weight
The default value is set to “1 - non.stoch.inflation.weight
”.
See non.stoch.inflation.weight
.
stoch.inflation.lower.bound
The user has the option of putting a lower bound on the stochastic rate of inflation/escalation.
stoch.inflation.rate
should not account for stoch.inflation.lower.bound
as this would result in incorrectly simulated future inflation rates.
The model properly applies the stoch.inflation.lower.bound
to both observed and future rates of inflation prior to “inflating” dollars in the triangle.
The user accounts for lower bounds by properly setting the value of stoch.inflation.lower.bound
.
stoch.inflation.lower.bound
should be on the real scale (x[i] / x[i-1] - 1
).
The default value is set to -1
, which is no bound.
Bounds are applied prior to weights.
There are three possible ways to specify stoch.inflation.weight
:
All stochastic rates of inflation in the triangle are bound by this value.
Its length must be total.dev.years
.
This vector is repeated to produce a matrix with each rows equal to it.
It will then be as if this matrix was supplied for this parameter.
See next item.
It must have number of rows equal to total.exp.years
and number of columns equal to total.dev.years
.
The row names should be equal to the row names of incremental.payments
.
Each cell represents the bound on the stochastic rate of inflation from the previous cell to that cell.
Cells in the first column represent inflation down rows.
Cells in other columns represent inflation from left to right.
Cell 1,1 is ignored.
stoch.inflation.upper.bound
Default value is Inf
, which is no bound.
See stoch.inflation.lower.bound
.
known.stoch.inflation.mean
The AR1 process used to simulate future stochastic rates of inflation has a non-zero mean which is (at least approximately) equal to the historical mean.
If for some reason (i.e., the series of inflation rates is too short) the user believes this historical mean poorly represents future rates of inflation, the user can override the estimation process.
If known.stoch.inflation.mean
is set to NA
, the mean is estimated. Otherwise the mean is assumed (with certainty) to be the specified value.
(Note that since the estimation takes place on the log scale, the logarithm of known.stoch.inflation.mean
plus 1 is used as the mean on the log scale;
this results in known.stoch.inflation.mean
being the geometric mean.
known.stoch.inflation.persistence
The user has the option of overriding the estimation of the rho coefficient in the AR1 process used to simulate future stochastic rates of inflation.
If known.stoch.inflation.persistence
is set to NA
, the rho coefficient is estimated; otherwise it is taken as this value.
The model estimates an inflation-free rate of decay up to the size of the triangle (dim(incremental.payments)[2]
).
Since no data is available to the model beyond this point, the model must be supplied with an assumption for future values.
This assumption is supplied via the parameter projected.rate.of.decay
in one of two ways:
NA
The inflation-free rate of decay for the final development year in the triangle (dim(incremental.payments)[2]
) is used for all future development years through development year total.dev.years
.
This is currently a rather low level interface allowing for much flexibility at the expense of some ease of usability. (In the (possibly near) future, it is likely that the burden placed on the user will be eased.) The named list must contain three elements (with an optional fourth element):
last.non.zero.payment
The named element last.non.zero.payment
refers to the last development year in which a non-zero payment may occur.
It is assumed that all subsequent incremental payments are exactly zero.
Must be at most total.dev.years
and at least dim(incrementals)[2]+2
.
last.non.zero.payment
must be specified as a named numeric vector of length total.exp.years
.
Element one then refers to the first exposure year; and element two to the second.
The names must start with dimnames(incrementals)[[1]][1]
and increment by 1.
last.non.zero.payment
can be omitted. If omitted, then the last.non.zero.payment
for each exposure year is total.dev.years
.
final.rate.of.decay.mean
The parameter final.rate.of.decay.mean
refers to the rate of decay in last.non.zero.payment
.
As the rate of decay is estimated on the log scale, final.rate.of.decay.mean
is first increased by 1 and then the log of the resulting value is taken; the result is then treated as the mean on the log scale.
This results in final.rate.of.decay.mean
being the geometric mean.
(final.rate.of.decay.mean=0.05
means that the mean of the final rate of decay (on the log scale) is log(1.05)
.)
This may be supplied as a single numeric value, in which case all exposure years are assumed to have the same final.rate.of.decay.mean
.
Or this may be supplied as a named numeric vector of length total.exp.years
.
Element one then refers to the first exposure year, and element two refers to the second, etc.
The names of the vector must start with dimnames(incrementals)[[1]][1]
and increment by 1
.
(A Technical Note: last.non.zero.payment
actually defines the final rate of decay since the rate of decay from it to the next development year is -1.00
.
Thus a better name for final.rate.of.decay.mean
does not refer to the final rate of decay but rather the penultimate rate of decay.)
final.rate.of.decay.sd
The parameter final.rate.of.decay.sd
refers to the standard deviation around final.rate.of.decay.mean
.
This may be supplied as a single numeric value, in which case all exposure years are assumed to have the same final.rate.of.decay.sd
.
Or this may be supplied as a named numeric vector of length total.exp.years
.
Element one then refers to the first exposure year, and element two refers to the second, etc.
The names of the vector must start with dimnames(incrementals)[[1]][1]
and increment by 1
.
final.rate.of.decay.weight
The basic concept behind a user-supplied rate of decay is that of a weighted average between the final estimated rate of decay (the one associated with dim(incrementals)[2]
) and
the final supplied value final.rate.of.decay.mean
.
Thus the user must supply a vector of weights to describe the path from the estimated value to the projected value.
The “weight” is the weight (on the log scale) of the user-supplied final.rate.of.decay
.
So, a value of 1
means that the projected rate of decay should take on final.rate.of.decay
and a value of 0
means that the projected rate of decay should equal the final estimated rate of decay.
Note that while these weights are allowed to be outside the interval [0,1]
, convention should dictate they remain within this interval.
These weights are supplied by specifying a value for final.rate.of.decay.weight
, which may be specified in two ways.
It may be specified as a numeric matrix with number of columns equal to total.dev.years - dim(incremental.payments)[2]
and number of rows equal to total.exp.years
,
in which case the first row corresponds to the first exposure year in incremental.payments
and the first column corresponds to the development year immediately following the last one in incremental.payments
.
It may be specified as a numeric vector of length total.dev.years - dim(incremental.payments)[2]
, in which case it is assumed to be the same for all exposure years.
As a safeguard, the cumulative and incremental triangles must match up. They are tested by taking the cumulative triangle and then decumulating it with the function decumulate
.
The decumulated triangle is then compared to the incremental triangle. Except for NA
's in either triangle, the values in the triangles must match. (Errors due to numerical precision are accounted for.)
The model allows for changes in the scale of the measurement error with development time.
Changes in the scale parameter (see scaleParameter
) are assumed to follow a second-order random walk on the log scale.
The model allows for imposed stationarity in the scale parameter by setting of the value last.column.with.scale.innovation
.
last.column.with.scale.innovation
must be coercible to an integer, be least 1, and at most the number of columns in incremental.payments
.
A value of 1 constrains the scale parameter in each column to the same value.
A value of dim(incremental.payments)[2]
allows for all columns to have their own scale parameter (but smoothed by the second-order random walk).
The effective value used by the model for this argument is the minimum of the supplied value and the last column in incremental.payments
with a non-missing value (on the log scale).
Note that since the scale parameter is assumed to follow a second-order random walk, a value of 2
results in an (effectively) unconstrained estimation for the scale parameter in the first column.
The consumption path is modeled (on the log scale) as a linear spline.
The number of knots in the spline is endogenous to the model estimation.
This allows the model to adapt to loss triangles of varying complexity.
In order to allow the user to give more credibility to models of a lower complexity (and possibly avoid overfitting), a truncated negative binomial prior is placed on the number of knots.
The truncation point is adjusted with the size of the triangle.
The paramters for this negative binomial can be specified with the argument prior.for.number.of.knots
, which should be a vector of two elements.
The first element should be any realy number greater than zero.
If this number is an integer, it can be interpreted as the number of failures until the experiment is stopped.
The second parameter should be a real number greater than 0 but less than 1 and represents the success probability.
The mean of the (un-truncated) negative binomial is then prior.for.number.of.knots[1] * prior.for.number.of.knots[2]/ (1 - prior.for.number.of.knots[2])
.
And the variance is prior.for.number.of.knots[1] * prior.for.number.of.knots[2]/ (1 - prior.for.number.of.knots[2]) ^ 2
.
An object of class AggModelInput
. The model specified by the returned object must then be estimated using the function runLossDevModel
.
Kim, Y., and J. McCulloch (2007) “The Skew-Student Distribution with Application to U.S. Stock Market Returns and the Equity Premium,” Department of Economics, Ohio State University, October 2007
rm(list=ls()) options(device.ask.default=FALSE) library(BALD) data(IncrementalGeneralLiablityTriangle) IncrementalGeneralLiablityTriangle <- as.matrix(IncrementalGeneralLiablityTriangle) data(PCE) PCE <- as.matrix(PCE)[,1] PCE.rate <- PCE[-1] / PCE[-length(PCE)] - 1 PCE.rate.length <- length(PCE.rate) print(PCE.rate[(-10):0 + PCE.rate.length]) PCE.years <- as.integer(names(PCE.rate)) years.available <- PCE.years <= max(as.integer( dimnames(IncrementalGeneralLiablityTriangle)[[1]])) PCE.rate <- PCE.rate[years.available] PCE.rate.length <- length(PCE.rate) standard.model.input <- makeStandardAnnualInput( incremental.payments = IncrementalGeneralLiablityTriangle, stoch.inflation.weight = 1, non.stoch.inflation.weight = 0, stoch.inflation.rate = PCE.rate, exp.year.type = 'ay', extra.dev.years=5, use.skew.t=TRUE)