# FitSpliced: Estimation of the threshold, the body and the tail parameters... In OpVaR: Statistical Methods for Modeling Operational Risk

## Description

Given a dataset with a chosen distribution for the data in the body and another distribution in the tail, the threshold, the parameters of the body and the tail distributions and the weights are estimated.

## Usage

 ```1 2 3``` ``` fitSpliced(cell, body, tail, method, thresh = NULL) fitSplicedPar(cell, thresh, body, tail) ```

## Arguments

 `cell` List containing the data in the component cell\$Loss `body` Distribution in the body. Can be chosen between "gamma", "lnorm", "weibull" or "erlang" `tail` Distribution in the tail. Can be chosen between "gpd", "gamma", "lnorm", "weibull" or "gh" `method` Method for the threshold estimation. In case of a GPD tail, it can be chosen between "BestFit", "Fixed", "dAMSE", "danielsson", "DK", "hall", "Himp", "HW", "mindist" or "RT" `thresh` Predetermined threshold quantile (if method="Fixed")

## Details

In the spliced model, the distribution of the data is spliced into two distributions, one in the body and another in the tail. Given the threshold t, a density function d1 for the body distribution and a density function d2 for the tail distribution, the incidental spliced density function has the formula d(x)=w*d1(x) if x<=t and d(x)=(1-w)*d2(x) of x>t. The weight w is needed to normalize the density function. The estimation of the spliced distribution consists of three steps. In the first step, the threshold given chosen body and tail distribution is estimated. For further details on the methods for the threshold estimation, see fitThreshold. In the second step, the parameters of the body and the tail distribution are obtained by maximum likelihood estimation. For spliced distributions, truncated body distributions are fitted to truncated data. For the estimation of the parameters of the tail distribution, only the data points above the threshold are used. In the last step, the weight w is obtained by maximum likelihood estimation.

## Value

Returns a sevdist object of type 'spliced' with the given body and tail distributions fitted to the loss data.

## Author(s)

Christina Zou, Leonie Wicht

 ```1 2``` ``` data(lossdat) fitSpliced(lossdat[[3]],"gamma","gpd",method="Fixed",thresh=2000) ```