fitTail: For fitting truncated distribution to the tails of data

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

View source: R/FitTrunTail.R

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

1
2
3
4
5
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)

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

...

for further argument to the fitting function

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 http://www.gamlss.org/).

Value

A fitted gamlss model

Author(s)

Bob Rigby, Mikis Stasinopoulos and Vlassios Voudouris

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.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

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, http://www.jstatsoft.org/v23/i07.

See Also

loglogSurv, logSurv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
data(film90)
F90 <- exp(film90$lborev1)# original scale
# trucated plots
# 10%
w403<- fitTail(F90, family=WEI3)
qqnorm(resid(w403))
abline(0,1, col="red")

## Not run: 
# 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])
#-------------------------

## End(Not run)

Example output

Loading required package: gamlss.dist
Loading required package: MASS
Loading required package: gamlss
Loading required package: splines
Loading required package: gamlss.data

Attaching package: 'gamlss.data'

The following object is masked from 'package:datasets':

    sleep

Loading required package: nlme
Loading required package: parallel
 **********   GAMLSS Version 5.1-3  ********** 
For more on GAMLSS look at http://www.gamlss.org/
Type gamlssNews() to see new features/changes/bug fixes.

1 ..2 ..3 ..4 ..5 ..6 ..7 ..8 ..9 ..10 ..11 ..12 ..13 ..14 ..15 ..16 ..17 ..18 ..19 ..20 ..21 ..22 ..23 ..24 ..25 ..26 ..27 ..28 ..29 ..30 ..31 ..32 ..33 ..34 ..35 ..36 ..37 ..38 ..39 ..40 ..41 ..42 ..43 ..44 ..45 ..46 ..47 ..48 ..49 ..50 ..51 ..52 ..53 ..54 ..55 ..56 ..57 ..58 ..59 ..60 ..61 ..62 ..63 ..64 ..65 ..66 ..67 ..68 ..69 ..70 ..71 ..72 ..73 ..74 ..75 ..76 ..77 ..78 ..79 ..80 ..81 ..82 ..83 ..84 ..85 ..86 ..87 ..88 ..89 ..90 ..91 ..92 ..93 ..94 ..95 ..96 ..97 ..98 ..99 ..100 ..101 ..102 ..103 ..104 ..105 ..106 ..107 ..108 ..109 ..110 ..111 ..112 ..113 ..114 ..115 ..116 ..117 ..118 ..119 ..120 ..121 ..122 ..123 ..124 ..125 ..126 ..127 ..128 ..129 ..130 ..131 ..132 ..133 ..134 ..135 ..136 ..137 ..138 ..139 ..140 ..141 ..142 ..143 ..144 ..145 ..146 ..147 ..148 ..149 ..150 ..151 ..152 ..153 ..154 ..155 ..156 ..157 ..158 ..159 ..160 ..161 ..162 ..163 ..164 ..165 ..166 ..167 ..168 ..169 ..170 ..171 ..172 ..173 ..174 ..175 ..176 ..177 ..178 ..179 ..180 ..181 ..182 ..183 ..184 ..185 ..186 ..187 ..188 ..189 ..190 ..191 ..192 ..193 ..194 ..195 ..196 ..197 ..198 ..199 ..200 ..201 ..202 ..203 ..204 ..205 ..206 ..207 ..208 ..209 ..210 ..211 ..212 ..213 ..214 ..215 ..216 ..217 ..218 ..219 ..220 ..221 ..222 ..223 ..224 ..225 ..226 ..227 ..228 ..229 ..230 ..231 ..232 ..233 ..234 ..235 ..236 ..237 ..238 ..239 ..240 ..241 ..242 ..243 ..244 ..245 ..246 ..247 ..248 ..249 ..250 ..251 ..252 ..253 ..254 ..255 ..256 ..257 ..258 ..259 ..260 ..261 ..262 ..263 ..264 ..265 ..266 ..267 ..268 ..269 ..270 ..271 ..272 ..273 ..274 ..275 ..276 ..277 ..278 ..279 ..280 ..281 ..282 ..283 ..284 ..285 ..286 ..287 ..288 ..289 ..290 ..291 ..292 ..293 ..294 ..295 ..296 ..297 ..298 ..299 ..300 ..301 ..302 ..303 ..304 ..305 ..306 ..307 ..308 ..309 ..310 ..311 ..312 ..313 ..314 ..315 ..316 ..317 ..318 ..319 ..320 ..321 ..322 ..323 ..324 ..325 ..326 ..327 ..328 ..329 ..330 ..331 ..332 ..333 ..334 ..335 ..336 ..337 ..338 ..339 ..340 ..341 ..342 ..343 ..344 ..345 ..346 ..347 ..348 ..349 ..350 ..351 ..352 ..353 ..354 ..355 ..356 ..357 ..358 ..359 ..360 ..361 ..362 ..363 ..364 ..365 ..366 ..367 ..368 ..369 ..370 ..371 ..372 ..373 ..374 ..375 ..376 ..377 ..378 ..379 ..380 ..381 ..382 ..383 ..384 ..385 ..386 ..387 ..388 ..389 ..390 ..391 ..392 ..393 ..394 ..395 ..396 ..397 ..There were 11 warnings (use warnings() to see them)
******************************************************************
	      Summary of the Quantile Residuals
                           mean   =  -0.007390017 
                       variance   =  1.026731 
               coef. of skewness  =  -0.03727448 
               coef. of kurtosis  =  2.74619 
Filliben correlation coefficient  =  0.9989058 
******************************************************************
1 ..2 ..3 ..4 ..5 ..6 ..7 ..8 ..9 ..10 ..11 ..12 ..13 ..14 ..15 ..16 ..17 ..18 ..19 ..20 ..21 ..22 ..23 ..24 ..25 ..26 ..27 ..28 ..29 ..30 ..31 ..32 ..33 ..34 ..35 ..36 ..37 ..38 ..39 ..40 ..41 ..42 ..43 ..44 ..45 ..46 ..47 ..48 ..49 ..50 ..51 ..52 ..53 ..54 ..55 ..56 ..57 ..58 ..59 ..60 ..61 ..62 ..63 ..64 ..65 ..66 ..67 ..68 ..69 ..70 ..71 ..72 ..73 ..74 ..75 ..76 ..77 ..78 ..79 ..80 ..81 ..82 ..83 ..84 ..85 ..86 ..87 ..88 ..89 ..90 ..91 ..92 ..93 ..94 ..95 ..96 ..97 ..98 ..99 ..100 ..101 ..102 ..103 ..104 ..105 ..106 ..107 ..108 ..109 ..110 ..111 ..112 ..113 ..114 ..115 ..116 ..117 ..118 ..119 ..120 ..121 ..122 ..123 ..124 ..125 ..126 ..127 ..128 ..129 ..130 ..131 ..132 ..133 ..134 ..135 ..136 ..137 ..138 ..139 ..140 ..141 ..142 ..143 ..144 ..145 ..146 ..147 ..148 ..149 ..150 ..151 ..152 ..153 ..154 ..155 ..156 ..157 ..158 ..159 ..160 ..161 ..162 ..163 ..164 ..165 ..166 ..167 ..168 ..169 ..170 ..171 ..172 ..173 ..174 ..175 ..176 ..177 ..178 ..179 ..180 ..181 ..182 ..183 ..184 ..185 ..186 ..187 ..188 ..189 ..190 ..191 ..192 ..193 ..194 ..195 ..196 ..197 ..198 ..199 ..200 ..201 ..202 ..203 ..204 ..205 ..206 ..207 ..208 ..209 ..210 ..211 ..212 ..213 ..214 ..215 ..216 ..217 ..218 ..219 ..220 ..221 ..222 ..223 ..224 ..225 ..226 ..227 ..228 ..229 ..230 ..231 ..232 ..233 ..234 ..235 ..236 ..237 ..238 ..239 ..240 ..241 ..242 ..243 ..244 ..245 ..246 ..247 ..248 ..249 ..250 ..251 ..252 ..253 ..254 ..255 ..256 ..257 ..258 ..259 ..260 ..261 ..262 ..263 ..264 ..265 ..266 ..267 ..268 ..269 ..270 ..271 ..272 ..273 ..274 ..275 ..276 ..277 ..278 ..279 ..280 ..281 ..282 ..283 ..284 ..285 ..286 ..287 ..288 ..289 ..290 ..291 ..292 ..293 ..294 ..295 ..296 ..297 ..298 ..299 ..300 ..301 ..302 ..303 ..304 ..305 ..306 ..307 ..308 ..309 ..310 ..311 ..312 ..313 ..314 ..315 ..316 ..317 ..318 ..319 ..320 ..321 ..322 ..323 ..324 ..325 ..326 ..327 ..328 ..329 ..330 ..331 ..332 ..333 ..334 ..335 ..336 ..337 ..338 ..339 ..340 ..341 ..342 ..343 ..344 ..345 ..346 ..347 ..348 ..349 ..350 ..351 ..352 ..353 ..354 ..355 ..356 ..357 ..358 ..359 ..360 ..361 ..362 ..363 ..364 ..365 ..366 ..367 ..368 ..369 ..370 ..371 ..372 ..373 ..374 ..375 ..376 ..377 ..378 ..379 ..380 ..381 ..382 ..383 ..384 ..385 ..386 ..387 ..388 ..389 ..390 ..391 ..392 ..393 ..394 ..395 ..396 ..397 ..Warning messages:
1: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)
2: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)
3: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)
4: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)
5: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)
6: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)
7: In MLE(ll2, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma),  :
  possible convergence problem: optim gave code=1 false convergence (8)

gamlss.tr documentation built on May 2, 2019, 7:15 a.m.