goftest: Goodness of fit tests for severity distributions

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/goftest.R

Description

Testing the goodness-of-fit of the distributions given in a sevdist or a freqdist object to the loss data.

Usage

1
  goftest(cell, object)

Arguments

cell

A data frame giving the losses (cell$Loss) and the user-defined period (cell$Period) in which the loss occured.

object

A loss severity model (sevdist object) or a loss frequency model (freqdist object)

Details

If object is of type sevdist, then the Kolmogorov-Smirnov test is performed on the loss data of a single cell and the respected fitted distribution given by the sevdist object.

If object is of type freqdist, then a χ^2 goodness-of-fit test will be performed.

Value

If object is of type sevdist, then the return is the test results from the Kolmogorow-Smirnov test.

If object is of type freqdist, then the functions returns the result of the χ^2 test.

Refer with $p.value to the p-values and $statistic to the test statistic of each of the tests.

Author(s)

Marius Pfeuffer, Christina Zou

References

Birnbaum, Z. W., and Fred H. Tingey. "One-sided confidence contours for probability distribution functions". The Annals of Mathematical Statistics 22.4 (1951): 592-596.

Conover, William Jay, and William Jay Conover. "Practical nonparametric statistics" (1980).

Durbin, James. "Distribution theory for tests based on the sample distribution function". Society for Industrial and Applied Mathematics, 1973.

See Also

We use the ks.test and chisq.test from stats.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data("lossdat")
opriskmodel = list()
opriskmodel[[1]] = list()
opriskmodel[[1]]$freqdist = fitFreqdist(lossdat[[1]],"pois")
opriskmodel[[1]]$sevdist = fitPlain(lossdat[[1]],"gamma")

# perform test on the sevdist object
goftest(lossdat[[1]], opriskmodel[[1]]$sevdist)

# show result p-value and test statistics the Kolmogorow-Smirnov test
test = goftest(lossdat[[1]], opriskmodel[[1]]$sevdist)
test$p.value
test$statistic

# perform test on the freqdist object
goftest(lossdat[[1]], opriskmodel[[1]]$freqdist)

# the p-value is given by 
goftest(lossdat[[1]], opriskmodel[[1]]$freqdist)$p.value

OpVaR documentation built on Sept. 8, 2021, 5:07 p.m.