Illustrating the use of the composite package

Bettina Grün

This vignette aims at illustrating the use of the composite package.

Fitting composite models to the Danish fire dataset

We load the Danish fire data set from package SMPracticals and only use the first 2492 observations:

data("danish", package = "SMPracticals")
danish <- sort(danish[1:2492])

The distributions available in package composite can be inspected using:

library("composite")
AvailDists()
##  [1] "weibull"      "invweibull"   "lnorm"        "invgauss"    
##  [5] "gamma"        "invgamma"     "exp"          "invexp"      
##  [9] "burr"         "invburr"      "pareto"       "genpareto"   
## [13] "invpareto"    "llogis"       "paralogis"    "invparalogis"

The Weibull-Inverse Weibull composite model

Fitting a composite model can take quite some time if started from random initializations. The general purpose optimizer takes some time and in general also several random initializations need to be used to be able to detect a good solution. We fit the model starting already from good parameter values:

## 'log Lik.' -3820.01 (df=4)
## 'log Lik.' -3820.01 (df=4)
## $dist1
## $dist1$pars
## [1] 16.0938258  0.9550137
## 
## $dist1$se
## [1] 1.55263402 0.01489257
## 
## 
## $dist2
## $dist2$pars
## [1] 1.555280 1.101897
## 
## $dist2$se
## [1] 0.05046683 0.09940680
## 
## 
## $theta
## [1] 0.9554533
## 
## $phi
## [1] 9.854426

To obtain this solution based on random initializations one would need to run the following code. This is not run due to the time needed.

The Paralogistic-Inverse Weibull composite model

We again fit the model starting already from good parameter values. We also indicate how the optimizer used can be changed:

## 'log Lik.' -3820.14 (df=4)
## 'log Lik.' -3820.14 (df=4)
## $dist1
## $dist1$pars
## [1] 16.0876508  0.8793767
## 
## $dist1$se
## [1] 1.58088739 0.02316916
## 
## 
## $dist2
## $dist2$pars
## [1] 1.554316 1.105082
## 
## $dist2$se
## [1] 0.0506580 0.1012642
## 
## 
## $theta
## [1] 0.9573294
## 
## $phi
## [1] 9.688238

The Inverse Burr-Inverse Weibull composite model

We again fit the model starting already from good parameter values.

## 'log Lik.' -3816.34 (df=5)
## 'log Lik.' -3816.34 (df=5)
## $dist1
## $dist1$pars
## [1]  0.2044248 68.7453024  1.0463729
## 
## $dist1$se
## [1]  0.23456000 73.87568784  0.01763984
## 
## 
## $dist2
## $dist2$pars
## [1] 1.556731 1.095654
## 
## $dist2$se
## [1] 0.04932298 0.09191888
## 
## 
## $theta
## [1] 0.9339289
## 
## $phi
## [1] 12.60854