Learn R Programming

gamlss.tr (version 5.1-9)

fitTail: For fitting truncated distribution to the tails of data

Description

There are two functions here. The function fitTail() which fits a truncated distribution to certain percentage of the tail of a response variable and the function fitTailAll() which does a sequence of truncated fits. Plotting the results from those fits is analogous to the Hill plot, Hill (1975).

Usage

fitTail(y, family = "WEI3", percentage = 10, howmany = NULL, 
      type = c("right", "left"), ...)
   
fitTailAll(y, family = "WEI3", percentage = 10, howmany = NULL, 
      type = c("right", "left"), plot = TRUE, 
      print = TRUE, save = FALSE, start = 5, trace = 0,  ...)

Value

A fitted gamlss model

Arguments

y

The variable of interest

family

a gamlsss.family distribution

percentage

what percentage of the tail need to be modelled, default is 10%

howmany

how many observations in the tail needed. This is an alternative to percentage. If it specified it take over from the percentage argument otherwise percentage is used.

type

which tall needs checking the right (default) of the left

plot

whether to plot with default equal TRUE

print

whether to print the coefficients with default equal TRUE

save

whether to save the fitted linear model with default equal FALSE

start

where to start fitting from the tail of the data

trace

0: no output 1: minimal 2: print estimates

...

for further argument to the fitting function

Author

Bob Rigby r.rigby@gre.ac.uk, Mikis Stasinopoulos d.stasinopoulos@gre.ac.uk and Vlassios Voudouris

Details

The idea here is to fit a truncated distribution to the tail of the data. Truncated log-normal and Weibull distributions could be appropriate distributions. More details can be found in Chapter 6 of "The Distribution Toolbox of GAMLSS" book which can be found in https://www.gamlss.com/).

References

Hill B. M. (1975) A Simple General Approach to Inference About the Tail of a Distribution Ann. Statist. Volume 3, Number 5, pp 1163-1174.

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.

Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, https://www.jstatsoft.org/v23/i07/.

Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.

(see also https://www.gamlss.com/).

See Also

loglogSurv, logSurv

Examples

Run this code
data(film90)
F90 <- exp(film90$lborev1)# original scale
# trucated plots
# 10%
w403<- fitTail(F90, family=WEI3)
qqnorm(resid(w403))
abline(0,1, col="red")

if (FALSE) {
# hill -sequential plot 10
w1<-fitTailAll(F90)
# plot sigma
plot(w1[,2])
#-----------------
#LOGNO
l403<- fitTail(F90, family=LOGNO)
plot(l403)
qqnorm(resid(l403))
abline(0,1)
#  hill -sequential plot 10
l1<-fitTailAll(F90, family=LOGNO)
plot(l1[,2])
#-------------------------
}

Run the code above in your browser using DataLab