R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("fExtremes-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('fExtremes') Loading required package: fBasics Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fBasics: Markets, Basic Statistics, Date and Time Loading required package: fCalendar Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fCalendar: Markets, Basic Statistics, Date and Time Loading required package: fSeries Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fSeries: The Dynamical Process Behind Financial Markets Loading required package: fMultivar Loading required package: mgcv This is mgcv 1.3-1 Loading required package: nnet Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fSeries 2: Multivariate Financial Markets Analysis Rmetrics, (C) 1999-2004, Diethelm Wuertz, GPL fExtremes: Beyond the Sample: Dealing with Extreme Values > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "A2-ExtremesPlots" > > ### * A2-ExtremesPlots > > flush(stderr()); flush(stdout()) > > ### Name: ExtremesPlots > ### Title: Explorative Data Analysis > ### Aliases: ExtremesPlots emdPlot qqPlot qqbayesPlot qPlot mePlot mrlPlot > ### mxfPlot msratioPlot recordsPlot ssrecordsPlot xacfPlot > ### interactivePlot gridVector > ### Keywords: hplot > > ### ** Examples > > ## emdPlot - > xmpExtremes("\nStart: Empirical Distribution Function >") > # Danish fire insurance data show Pareto tail behaviour: > par(mfrow = c(2, 2)) > data(danish) > emdPlot(danish, plottype = "xy", labels = FALSE) > title(xlab = "x", ylab = "1-F(x)", main = "Danish Fire") > # BMW Stocks: > data(bmw) > emdPlot(bmw, plottype = "xy", labels = FALSE) > title(xlab = "x", ylab = "1-F(x)", main = "BMW Stocks") > # Simulated Student-t: > emdPlot(rt(5000, 4), plottype = "xy") > > ## qqPlot - > xmpExtremes("\nNext: Quantile-Quantile Plot >") > # QQ-Plot of Simulated Normal rvs: > par(mfrow = c(2, 2)) > set.seed(4711) > qqPlot(rnorm(5000)) [1] "Normal QQ-Plot" > text(-3.5, 3, pos = 4, "Simulated Normal rvs") > # QQ-Plot of simulated Student-t rvs: > qqPlot(rt(5000, 4)) [1] "Normal QQ-Plot" > text(-3.5, 11.0, pos = 4, "Simulated Student-t rvs") > # QQ-Plot of BMW share residuals: > data(bmw) > qqPlot(bmw) [1] "Normal QQ-Plot" > text(-3.5, 0.09, pos = 4, "BMW log returns") > > ## qPlot - > xmpExtremes("\nNext: QQ-Plot of Heavy Tails >") > # QQ-Plot of heavy-tailed Danish fire insurance data: > data(danish) > qPlot(danish) > > ## mePlot - > xmpExtremes("\nNext: Mean Excess Plot >") > # Sample mean excess plot of heavy-tailed Danish fire > # insurance data > par(mfrow = c(3, 2)) > data(danish) > mePlot(danish, labels = FALSE) > title(xlab = "u", ylab = "e", main = "mePlot - Danish Fire Data") > > ## mrlPlot - > xmpExtremes("\nNext: mean Residual Live Plot >") > # Sample mean residual live plot of heavy-tailed Danish Fire > # insurance data > mrlPlot(danish, labels = FALSE) > title(xlab = "u", ylab = "e", main = "mrlPlot - Danish Fire Data") > > ## mxfPlot - > xmpExtremes("\nNext: Mean Excess Function Plot >") > # Plot the mean excess functions for randomly distributed > # residuals > par(mfrow = c(2, 2)) > n = 10000 > set.seed(4711) > xlab = "Threshold: u"; ylab = "Mean Excess: e" > mxfPlot(rnorm(n), tail = 0.5, labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "mxf Plot - Normal DF") > set.seed(7138) > mxfPlot(rexp(n, 2), tail = 0.5, labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "mxfPlot - Exponential DF") > abline(1/2, 0) > set.seed(6952) > mxfPlot(rlnorm(n, 0, 2), tail = 0.5, xlim = c(0,90), + ylim = c(0, 120), labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "mxfPlot - Lognormal DF") > set.seed(8835) > mxfPlot(rgpd(n, 1/2), tail = 0.10, xlim = c(0,200), + ylim=c(0,200), labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "mxfPlot - Pareto") > abline(0, 1) > > ## msratioPlot - > xmpExtremes("\nNext: Maximum/Sum Ratio Plot >") > # Examples for Ratio of Maximum and Sum Plots: > par(mfrow = c(3, 2)) > data(bmw) > xlab = "n"; ylab = "R(n)" > msratioPlot (rnorm(8000), labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "Standard Normal") > msratioPlot (rexp(8000), labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "Exponential") > msratioPlot (rt(8000, 4), labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "Student-t") > msratioPlot (rcauchy(8000), labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "Cauchy") > msratioPlot (bmw, labels = FALSE) > title(xlab = xlab, ylab = ylab, main = "BMW Returns") > > ## recordsPlot - > xmpExtremes("\nNext: Records Plot >") > # Record fire insurance losses in Denmark > par(mfrow = c(2, 2)) > data(danish) > recordsPlot(danish) > text(1, 7.9, pos = 4, "Danish Fire") > # BMW Stocks > data(bmw) > recordsPlot(bmw) > text(1, 12.8, pos = 4, "BMW Shares") > > ## ssrecordsPlot - > xmpExtremes("\nNext: Subsample Record Plot >") > # Record fire insurance losses in Denmark > ssrecordsPlot(danish) > text(1, 9.2, pos = 4, "Danish Fire") > # BMW Stocks > ssrecordsPlot(bmw) > text(1, 10.5, pos = 4, "BMW Shares") > > ## xacfPlot - > xmpExtremes("\nNext: ACF Plot of Exceedences >") > # Plot ACF of Heights/Distances of Eceedences over threshold: > par(mfrow = c(2, 2)) > data(bmw) > xacfPlot(bmw) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "A3-ExtremesPreprocessing" > > ### * A3-ExtremesPreprocessing > > flush(stderr()); flush(stdout()) > > ### Name: ExtremesPreprocessing > ### Title: Preprocessing Extreme Value Data > ### Aliases: ExtremesPreprocessing findThreshold blocks blockMaxima > ### deCluster > ### Keywords: data > > ### ** Examples > > ## findThreshold - > xmpExtremes("\nStart: Find Thresold >") > # Find threshold giving (at least) fifty exceedances > # for Danish Fire data > data(danish) > findThreshold(danish, n = c(10, 50, 100)) [1] 38.15439 17.06847 10.50000 > > ## blockMaxima - > xmpExtremes("\nNext: Compute Block Maxima >") > # Block Maxima (Minima) for the right and left tails > # of the BMW log returns: > data(bmw) > par(mfrow = c(2, 1)) > blockMaxima( bmw, block = 100) [1] 0.04770410 0.05777954 0.08570879 0.05814339 0.07356377 0.06627812 [7] 0.04774362 0.03609579 0.02224307 0.02901701 0.04006161 0.02674273 [13] 0.02967623 0.02839504 0.02837364 0.02015991 0.03086640 0.06841199 [19] 0.03807012 0.06993022 0.04052802 0.04069590 0.04524335 0.04428878 [25] 0.02813696 0.02798684 0.03842747 0.03726731 0.04031627 0.02665524 [31] 0.05408877 0.05046767 0.06634279 0.09034829 0.05577568 0.06628046 [37] 0.04317288 0.04676699 0.11719179 0.08502850 0.04099124 0.02820872 [43] 0.02972372 0.05715207 0.05717683 0.03105917 0.06767476 0.08863204 [49] 0.04470772 0.04132586 0.03595831 0.05559860 0.02910799 0.06860589 [55] 0.07947459 0.06668912 0.03500941 0.03091335 0.03136727 0.02297398 [61] 0.03309369 0.01913395 > blockMaxima(-bmw, block = 100) [1] 0.05525992 0.05084288 0.06887800 0.10617520 0.05865478 0.04466626 [7] 0.04071008 0.01930148 0.02896766 0.04122546 0.03094040 0.03465775 [13] 0.02606819 0.02535533 0.02710781 0.02185151 0.02800261 0.06955422 [19] 0.03859640 0.06807869 0.02732490 0.04194781 0.04957226 0.01821111 [25] 0.02652559 0.04541566 0.02695412 0.03051167 0.03984488 0.02648610 [31] 0.04525858 0.03236528 0.05561317 0.04609111 0.06519183 0.04880244 [37] 0.04565154 0.04148352 0.10852160 0.04256177 0.03225168 0.02308842 [43] 0.02272718 0.14061565 0.03354484 0.06611286 0.07529138 0.04328683 [49] 0.10577463 0.02295675 0.04317727 0.05806183 0.03004121 0.03973532 [55] 0.02688352 0.04001846 0.03012671 0.03412405 0.02273563 0.03490287 [61] 0.01929721 0.02014457 > > ## deCluster - > xmpExtremes("\nNext: De-Cluster Exceedences >") > # Decluster the 200 exceedances of a particular > # threshold in the negative BMW log-return data > par(mfrow = c(2, 2)) > fit = potFit(-bmw, nextremes = 200) > deCluster(fit$fit$data, 30) [1] 0.05525992 0.05084288 0.06689143 0.06887800 0.04688708 0.10617520 [7] 0.05865478 0.04071008 0.02896766 0.02913723 0.04122546 0.03094040 [13] 0.02659780 0.03465775 0.02606819 0.02710781 0.06955422 0.03859640 [19] 0.03845126 0.06807869 0.02732490 0.04194781 0.02563799 0.04957226 [25] 0.03744841 0.02652559 0.03021099 0.04541566 0.02695412 0.03051167 [31] 0.03984488 0.02648610 0.04525858 0.03938106 0.03236528 0.05561317 [37] 0.03191673 0.04609111 0.06519183 0.03668970 0.03540193 0.04491698 [43] 0.04880244 0.04565154 0.04148352 0.02619353 0.10852160 0.02954286 [49] 0.03225168 0.14061565 0.02895132 0.02834847 0.03360120 0.07529138 [55] 0.04328683 0.03405556 0.02677080 0.03221330 0.10577463 0.02764203 [61] 0.05806183 0.03004121 0.03973532 0.02892858 0.02688352 0.04001846 [67] 0.03412405 0.03232889 0.03123302 0.03490287 attr(,"times") [1] "1973-02-05 01:00:00 CET" "1973-07-26 02:00:00 CEST" [3] "1973-11-14 01:00:00 CET" "1973-12-31 01:00:00 CET" [5] "1974-05-09 01:00:00 CET" "1974-07-05 02:00:00 CEST" [7] "1974-09-30 01:00:00 CET" "1975-05-27 01:00:00 CET" [9] "1976-04-06 01:00:00 CET" "1976-07-28 02:00:00 CEST" [11] "1976-10-12 01:00:00 CET" "1976-11-15 01:00:00 CET" [13] "1977-02-18 01:00:00 CET" "1977-07-08 02:00:00 CEST" [15] "1977-12-06 01:00:00 CET" "1978-06-21 02:00:00 CEST" [17] "1979-07-11 02:00:00 CEST" "1980-01-21 01:00:00 CET" [19] "1980-03-18 01:00:00 CET" "1980-06-20 02:00:00 CEST" [21] "1980-09-08 02:00:00 CEST" "1981-01-27 01:00:00 CET" [23] "1981-04-29 02:00:00 CEST" "1981-06-26 02:00:00 CEST" [25] "1981-08-25 02:00:00 CEST" "1982-04-27 02:00:00 CEST" [27] "1982-08-17 02:00:00 CEST" "1982-09-27 01:00:00 CET" [29] "1983-01-24 01:00:00 CET" "1983-07-12 02:00:00 CEST" [31] "1984-02-09 01:00:00 CET" "1984-03-12 01:00:00 CET" [33] "1984-07-05 02:00:00 CEST" "1984-10-19 01:00:00 CET" [35] "1985-03-25 01:00:00 CET" "1985-07-10 02:00:00 CEST" [37] "1985-09-13 02:00:00 CEST" "1985-11-05 01:00:00 CET" [39] "1986-02-27 01:00:00 CET" "1986-04-28 02:00:00 CEST" [41] "1986-06-03 02:00:00 CEST" "1986-07-04 02:00:00 CEST" [43] "1986-09-05 02:00:00 CEST" "1987-02-04 01:00:00 CET" [45] "1987-04-27 02:00:00 CEST" "1987-06-02 02:00:00 CEST" [47] "1987-11-09 01:00:00 CET" "1988-03-25 01:00:00 CET" [49] "1988-05-11 02:00:00 CEST" "1989-10-16 01:00:00 CET" [51] "1990-01-04 01:00:00 CET" "1990-02-26 01:00:00 CET" [53] "1990-04-23 02:00:00 CEST" "1990-09-25 02:00:00 CEST" [55] "1991-01-14 01:00:00 CET" "1991-02-26 01:00:00 CET" [57] "1991-05-17 02:00:00 CEST" "1991-06-28 02:00:00 CEST" [59] "1991-08-19 02:00:00 CEST" "1992-05-13 02:00:00 CEST" [61] "1992-09-24 02:00:00 CEST" "1993-01-25 01:00:00 CET" [63] "1993-05-14 02:00:00 CEST" "1993-07-27 02:00:00 CEST" [65] "1993-11-22 01:00:00 CET" "1994-06-20 02:00:00 CEST" [67] "1994-11-23 01:00:00 CET" "1995-03-09 01:00:00 CET" [69] "1995-09-22 02:00:00 CEST" "1995-10-23 01:00:00 CET" > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B1-GevDistribution" > > ### * B1-GevDistribution > > flush(stderr()); flush(stdout()) > > ### Name: GevDistribution > ### Title: GEV Distributions for Extreme Value Theory > ### Aliases: GevDistribution dgev pgev qgev rgev devd pevd qevd revd > ### Keywords: distribution > > ### ** Examples > > ## *gev - > xmpExtremes("\nStart: GEV Frechet >") > # Create and plot 1000 GEV/Frechet distributed rdv: > par(mfrow = c(3, 3)) > r = rgev(n = 1000, xi = 1) > plot(r, type = "l", main = "GEV/Frechet Series") > ## Plot empirical density and compare with true density: > ## Omit values greater than 500 from plot > hist(r[r<10], n = 25, probability = TRUE, xlab = "r", + xlim = c(-5, 5), ylim = c(0, 1.1), main = "Density") > x = seq(-5, 5, by=0.01) > lines(x, dgev(x, xi = 1), col = 2) > ## Plot df and compare with true df: > plot(sort(r), (1:length(r)/length(r)), + xlim = c(-3, 6), ylim = c(0, 1.1), + cex = 0.5, ylab = "p", xlab = "q", main = "Probability") > q = seq(-5,5, by=0.1) > lines(q, pgev(q, xi=1), col=2) > ## Compute quantiles, a test: > qgev(pgev(seq(-5, 5, 0.25), xi = 1), xi = 1) [1] -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 -1.00 [13] -1.00 -1.00 -1.00 -1.00 -1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 [25] 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 [37] 4.00 4.25 4.50 4.75 5.00 > > ## *gev - > xmpExtremes("\nNext: GEV Gumbel >") > # Create and plot 1000 Gumbel distributed rdv: > ##> r = rgev(n = 1000, xi = 0) > ##> plot(r, type = "l", main = "Gumbel Series") > ## Plot empirical density and compare with true density: > ##>hist(r[abs(r)<10], nclass = 25, freq = FALSE, xlab = "r", > ##> xlim = c(-5,5), ylim = c(0,1.1), main = "Density") > ##>x = seq(-5, 5, by = 0.01) > ##>lines(x, dgev(x, xi = 0), col=2) > ## Plot df and compare with true df: > ##>plot(sort(r), (1:length(r)/length(r)), > ##> xlim = c(-3, 6), ylim = c(0, 1.1), > ##> cex=0.5, ylab = "p", xlab="q", main="Probability") > ##>q = seq(-5, 5, by = 0.1) > ##>lines(q, pgev(q, xi = 0), col = 2) > ## Compute quantiles, a test: > ##>qgev(pgev(seq(-5, 5, 0.25), xi = 0), xi = 0) > > ## *gev - > xmpExtremes("\nNext: GEV Weibull >") > # Create and plot 1000 Weibull distributed rdv: > r = rgev(n = 1000, xi = -1) > plot(r, type = "l", main = "Weibull Series") > ## Plot empirical density and compare with true density: > hist(r[abs(r)<10], nclass = 25, freq = FALSE, xlab = "r", + xlim=c(-5,5), ylim=c(0,1.1), main="Density") > x = seq(-5, 5, by=0.01) > lines(x, dgev(x, xi = -1), col = 2) > ## Plot df and compare with true df: > plot(sort(r), (1:length(r)/length(r)), + xlim = c(-3, 6), ylim = c(0, 1.1), + cex = 0.5, ylab = "p", xlab = "q", main = "Probability") > q=seq(-5, 5, by = 0.1) > lines(q, pgev(q, xi = -1), col = 2) > ## Compute quantiles, a test: > qgev(pgev(seq(-5, 5, 0.25), xi = -1), xi = -1) [1] -5.00 -4.75 -4.50 -4.25 -4.00 -3.75 -3.50 -3.25 -3.00 -2.75 -2.50 -2.25 [13] -2.00 -1.75 -1.50 -1.25 -1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 [25] 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 [37] 1.00 1.00 1.00 1.00 1.00 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B2-GevFit" > > ### * B2-GevFit > > flush(stderr()); flush(stdout()) > > ### Name: GevFit > ### Title: Modelling the GEV Distribution > ### Aliases: GevFit gevSim gevFit print.gevFit plot.gevFit summary.gevFit > ### gevrlevelPlot > ### Keywords: models > > ### ** Examples > > ## gevSim - > ## gevFit - > # Simulate GEV Data: > xmpExtremes("\nStart: Simulte GEV Sample >") > # Use default length n=1000 > x = gevSim(model = list(shape = 0.25, location =0 , scale = 1)) > # Fit GEV Data by Probability Weighted Moments: > fit = gevFit(x, type = "pwm") > print(fit) Call: gevFit(x = x, type = "pwm") Estimation Type: gev pwm Estimated Parameters: xi sigma mu 0.2787613 0.9333495 -0.0624307 > # Summarize Results: > par(mfcol = c(3, 2)) > summary(fit) Call: gevFit(x = x, type = "pwm") Estimation Type: gev pwm Estimated Parameters: xi sigma mu 0.2787613 0.9333495 -0.0624307 > > ## gevFit - > # Fit GEV Data by Max Log Likelihood Method: > xmpExtremes("\nNext: Estimate Parameters >") > fit = gevFit(x, type = "mle") > print(fit) Call: gevFit(x = x, type = "mle") Estimation Type: gev mle Estimated Parameters: xi sigma mu 0.26399924 0.95072588 -0.05481944 > # Summarize Results: > summary(fit) Call: gevFit(x = x, type = "mle") Estimation Type: gev mle Estimated Parameters: xi sigma mu 0.26399924 0.95072588 -0.05481944 Standard Deviations: xi sigma mu 0.02575889 0.02788234 0.03389952 Log-Likelihood Value: 1679.455 Type of Convergence: 0 > > ## gevSim - > ## gevFit - > # Simulate Gumbel Data: > xmpExtremes("\nNext: Simulte Gumbel Sample >") > # Use default length n=1000 > ##> x = gevSim(model = list(shape = 0, location = 0, scale = 1)) > # Fit Gumbel Data by Probability Weighted Moments: > ##> fit = gevFit(x, type = "pwm", gumbel = TRUE) > ##> print(fit) > # Summarize Results: > ##> par(mfcol = c(3, 2)) > ##> summary(fit) > > ## Fit Gumbel Data by Max Log Likelihood Method: > xmpExtremes("\nNext: Estimate Parameters >") > ##> fit = gevFit(x, type = "mle", gumbel = TRUE) > ##> print(fit) > # Summarize Results: > ##> summary(fit) > ##> xmpExtremes("Press any key to continue >") > > ## Return levels based on GEV Fit: > # BMW Stock Data: > xmpExtremes("\nNext: Compute BMW Return Levels >") > par(mfrow = c(2, 1)) > data(bmw) > # Fit GEV to monthly Block Maxima: > fit = gevFit(-bmw, block = "month") > # Calculate the 40 month return level > gevrlevelPlot(fit, k.block = 40, main = "BMW: Return Levels") min v max 0.06117160 0.07056898 0.08500193 > > ## Return levels based on GEV Fit: > xmpExtremes("\nNext: Compute SIEMENS Return Levels >") > # Siemens Stock Data: > data(siemens) > # Fit GEV to monthly Block Maxima: > fit = gevFit(-siemens, block = "month") > # Calculate the 40 month return level > gevrlevelPlot(fit, k.block = 40, main = "SIEMENS: Return Levels") min v max 0.04983656 0.05844122 0.07224392 > > ## Interactive Plot: > ##> par(mfrow = c(1, 1), ask = TRUE) > ##> plot(fit) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B3-GevGlmFit" > > ### * B3-GevGlmFit > > flush(stderr()); flush(stdout()) > > ### Name: GevGlmFit > ### Title: Modelling the GEV Distribution including GLM > ### Aliases: GevGlmFit gevglmFit print.gevglmFit plot.gevglmFit > ### summary.gevglmFit gevglmprofPlot gevglmprofxiPlot > ### Keywords: models > > ### ** Examples > > ## Simulated GEV Data: > xmpExtremes("\nStart: Simulte GEV Sample >") > x = gevSim(model = list(shape = 0.25, location = 0, scale = 1), n = 1000) > par(mfrow = c(2, 2)) > plot(x, main = "Simulated GEV Data") > # Fit GEV Data: > fit = gevglmFit(x) > print(fit) Call: gevglmFit(x = x) Estimation Type: gevglm mle Estimated Parameters: xi sigma mu 0.26399924 0.95072588 -0.05481944 > # Summarize Results: > summary(fit, which = c(TRUE, TRUE, TRUE, FALSE)) Call: gevglmFit(x = x) Estimation Type: gevglm mle Estimated Parameters: xi sigma mu 0.26399924 0.95072588 -0.05481944 Standard Deviations: xi sigma mu 0.02575889 0.02788234 0.03389952 Log-Likelihood Value: 1679.455 Type of Convergence: 0 > > ## Simulated GEV Data: > xmpExtremes("\nNext: Estimate Parameters >") > ##> x = gevSim(model = list(shape = 0, location = 0, scale = 1), n = 1000) > ##> par(mfrow = c(2, 2)) > ##> plot(x, main = "Simulated Gumbel Data") > # Fit GEV Data: > ##> fit = gevglmFit(x, gumbel = TRUE) > ##> print(fit) > # Summarize Results: > ##> summary(fit, which = c(TRUE, TRUE, TRUE, FALSE)) > > ## Portpirie Data: > xmpExtremes("\nNext: Fit Portpirie Data >") > par(mfrow = c(2, 1)) > data(portpirie) > fit = gevglmFit(portpirie[, 2]) > gevglmprofPlot(fit, m = 10, 4.1, 5) If routine fails, try changing plotting interval > title(main = "Portpirie") > gevglmprofxiPlot(fit, -0.3, 0.3) If routine fails, try changing plotting interval > title(main = "Portpirie") > > ## Interactive Plot: > ##> par(mfrow = c(2, 2)) > ##> plot(fit) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B4-MdaPlots" > > ### * B4-MdaPlots > > flush(stderr()); flush(stdout()) > > ### Name: MdaPlots > ### Title: Hill and Shape Parameter Plots > ### Aliases: MdaPlots hillPlot shaparmPlot shaparmPickands shaparmHill > ### shaparmDEHaan > ### Keywords: math > > ### ** Examples > > ## hillPlot - > xmpExtremes("\nStart: Hill Estimator >") > # Hill plot of heavy-tailed Danish fire insurance data > # and BMW stock data for estimated 0.999 quantile > par(mfrow = c(2, 2)) > data(bmw) > hillPlot(bmw) > hillPlot(bmw, option = "quantile", end = 500, p = 0.999) > data(danish) > hillPlot(danish) > hillPlot(danish, option = "quantile", end = 500, p = 0.999) > > ## shaparmPlot - > xmpExtremes("\nNext: Shape Parameter Plots >") > par(mfcol = c(3, 2), cex = 0.6) > data(bmw) > shaparmPlot(bmw) Taildepth: 0.01 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.5224329 0.2454821 -0.0159241 [1] 0.3691800 0.1666034 -0.1255997 Taildepth: 0.02 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.3974776 0.2689212 0.1006501 [1] -0.04261406 0.22408628 -0.13792978 Taildepth: 0.03 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.5129546 0.2747539 0.1532940 [1] 0.16927388 0.24452252 -0.05654927 Taildepth: 0.04 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.3834767 0.2839799 0.1670466 [1] 0.29451502 0.25998177 -0.01256018 Taildepth: 0.05 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2589180 0.2931234 0.1720891 [1] 0.32431490 0.27114341 0.02089733 Taildepth: 0.06 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.1742259 0.3034118 0.1712146 [1] 0.26282494 0.27982851 0.04437541 Taildepth: 0.07 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.1579362 0.3124396 0.1716353 [1] 0.23192071 0.28550397 0.06847172 Taildepth: 0.08 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.1370967 0.3193746 0.1764659 [1] 0.2427135 0.2901846 0.0875348 Taildepth: 0.09 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.1262974 0.3260446 0.1800914 [1] 0.2563105 0.2945686 0.1012523 Taildepth: 0.1 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.1457659 0.3315893 0.1842549 [1] 0.2452739 0.2999479 0.1098189 $tails [1] 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 $lower $lower$pickands [1] 0.5224329 0.3974776 0.5129546 0.3834767 0.2589180 0.1742259 0.1579362 [8] 0.1370967 0.1262974 0.1457659 $lower$hill [1] 0.2454821 0.2689212 0.2747539 0.2839799 0.2931234 0.3034118 0.3124396 [8] 0.3193746 0.3260446 0.3315893 $lower$dehaan [1] -0.0159241 0.1006501 0.1532940 0.1670466 0.1720891 0.1712146 [7] 0.1716353 0.1764659 0.1800914 0.1842549 $upper $upper$pickands [1] 0.36917999 -0.04261406 0.16927388 0.29451502 0.32431490 0.26282494 [7] 0.23192071 0.24271350 0.25631053 0.24527389 $upper$hill [1] 0.1666034 0.2240863 0.2445225 0.2599818 0.2711434 0.2798285 0.2855040 [8] 0.2901846 0.2945686 0.2999479 $upper$dehaan [1] -0.12559970 -0.13792978 -0.05654927 -0.01256018 0.02089733 0.04437541 [7] 0.06847172 0.08753480 0.10125232 0.10981886 > > ## shaparmPlot - > xmpExtremes("\nNext: Simulated Frechet Data >") > par(mfcol = c(3, 2), cex = 0.6) > set.seed(4711) > x = rgev(10000, xi = 1/4) > shaparmPlot(x, revert = TRUE, both.tails = FALSE) Taildepth: 0.01 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.4795354 0.2939025 0.2034202 Taildepth: 0.02 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2352240 0.3150122 0.2258588 Taildepth: 0.03 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2802439 0.3250268 0.2425888 Taildepth: 0.04 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.3174788 0.3310540 0.2553399 Taildepth: 0.05 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.3205928 0.3349187 0.2651525 Taildepth: 0.06 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.3115011 0.3416432 0.2653683 Taildepth: 0.07 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2919714 0.3481917 0.2652338 Taildepth: 0.08 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2667770 0.3546407 0.2646682 Taildepth: 0.09 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2402061 0.3610996 0.2638406 Taildepth: 0.1 Pickands - Hill - DeckerEinmaalDeHaan: [1] 0.2127520 0.3674517 0.2630136 $tails [1] 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 $lower $lower$pickands [1] 0.4795354 0.2352240 0.2802439 0.3174788 0.3205928 0.3115011 0.2919714 [8] 0.2667770 0.2402061 0.2127520 $lower$hill [1] 0.2939025 0.3150122 0.3250268 0.3310540 0.3349187 0.3416432 0.3481917 [8] 0.3546407 0.3610996 0.3674517 $lower$dehaan [1] 0.2034202 0.2258588 0.2425888 0.2553399 0.2651525 0.2653683 0.2652338 [8] 0.2646682 0.2638406 0.2630136 > lines(c(0.01, 0.1), c(4, 4), col = "steelblue3") # True Value > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C1-GpdDistribution" > > ### * C1-GpdDistribution > > flush(stderr()); flush(stdout()) > > ### Name: GpdDistribution > ### Title: GPD Distributions for Extreme Value Theory > ### Aliases: GpdDistribution dgpd pgpd qgpd rgpd > ### Keywords: distribution > > ### ** Examples > > ## *gpd - > xmpExtremes("\nStart: Simulate GPD Distributed sample >") > par(mfrow = c(2, 2)) > r = rgpd(n = 1000, xi = 1/4) > plot(r, type = "l", main = "GPD Series") > > ## Plot empirical density and compare with true density: > ## Omit values greater than 500 from plot > xmpExtremes("\nNext: Plot Empirical and True Density >") > hist(r, n = 50, probability = TRUE, xlab = "r", + xlim = c(-5, 5), ylim = c(0, 1.1), main = "Density") > x = seq(-5, 5, by = 0.01) > lines(x, dgpd(x, xi = 1/4), col = "steelblue3") > > ## Plot df and compare with true df: > xmpExtremes("\nNext: Plot Empirical and True Probability >") > plot(sort(r), (1:length(r)/length(r)), + xlim = c(-3, 6), ylim = c(0, 1.1), + cex = 0.5, ylab = "p", xlab = "q", main = "Probability") > q = seq(-5, 5, by = 0.1) > lines(q, pgpd(q, xi = 1/4), col = "steelblue3") > > ## Compute quantiles, a test: > xmpExtremes("\nNext: Compute Quantiles >") > qgpd(pgpd(seq(-1, 5, 0.25), xi = 1/4 ), xi = 1/4) [1] 0.00 0.00 0.00 0.00 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 [16] 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 > > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C2-GpdFit" > > ### * C2-GpdFit > > flush(stderr()); flush(stdout()) > > ### Name: GpdFit > ### Title: Modelling the Generalized Pareto Distribution > ### Aliases: GpdFit gpdSim gpdFit print.gpdFit plot.gpdFit summary.gpdFit > ### gpdqPlot gpdquantPlot gpdriskmeasures gpdsfallPlot gpdshapePlot > ### gpdtailPlot > ### Keywords: models > > ### ** Examples > > ## Load Data: > data(danish) > > ## gpdSim - > # Simulate GPD Data: > xmpExtremes("\nStart: Simulate a GPD Distributed Sample > ") > x = gpdSim(model = list(shape = 0.25, location = 0, scale = 1), n = 1000) > > ## gpdFit - > xmpExtremes("\nNext: Fit Simulated Data to GPD using PWM > ") > fit = gpdFit(x, nextremes = length(x), type = "pwm") > print(fit) Call: gpdFit(x = x, nextremes = length(x), type = "pwm") Estimation Type: gpd pwm Estimated Parameters: xi beta 0.2916836 0.9742586 > par(mfcol = c(4, 2), cex = 0.7) > summary(fit) Call: gpdFit(x = x, nextremes = length(x), type = "pwm") Estimation Type: gpd pwm Estimated Parameters: xi beta 0.2916836 0.9742586 Standard Deviations: xi beta 0.04248952 0.04987430 Log-Likelihood Value: NA Type of Convergence: NA > > ## gpdFit - > xmpExtremes("\nNext: Fit Simulated Data to GPD using MLE > ") > fit = gpdFit(x, nextremes = length(x), type = "mle") > print(fit) Call: gpdFit(x = x, nextremes = length(x), type = "mle") Estimation Type: gpd ml Estimated Parameters: xi beta 0.2862946 0.9786745 > summary(fit) Call: gpdFit(x = x, nextremes = length(x), type = "mle") Estimation Type: gpd ml Estimated Parameters: xi beta 0.2862946 0.9786745 Standard Deviations: xi beta 0.04035302 0.04940762 Log-Likelihood Value: 1263.129 Type of Convergence: 0 > > ## gpdFit - > xmpExtremes("\nNext: Fit Danish Fire Data to Excess Losses over 10 > ") > fit = gpdFit(danish, 10, type = "mle") > print(fit) Call: gpdFit(x = danish, threshold = 10, type = "mle") Estimation Type: gpd ml Estimated Parameters: xi beta 0.4968062 6.9745523 > par(mfrow = c(2, 2), cex = 0.7) > summary(fit) Call: gpdFit(x = danish, threshold = 10, type = "mle") Estimation Type: gpd ml Estimated Parameters: xi beta 0.4968062 6.9745523 Standard Deviations: xi beta 0.1362093 1.1131016 Log-Likelihood Value: 374.893 Type of Convergence: 0 > > ## gpdqPlot - > xmpExtremes("\nNext: 99.5th Percentiles for Danish Fire Data > ") > fit = gpdFit(danish, threshold = 10, type = "mle") > par(mfrow = c(1, 1)) > tail = gpdtailPlot(fit) > gpdqPlot(tail, 0.995) Lower CI Estimate Upper CI 32.59845 40.16160 54.43935 > title(main = "Danish Data: 99.5th Percentile") > > ## gpdquantPlot - > xmpExtremes("\nNext: 99.9th Percentiles for Danish Fire Data > ") > par(mfrow = c(1, 1)) > gpdquantPlot(danish, p = 0.999) > title(sub = "Danish Fire: GPD High Quantile") > > ## gpdsfallPlot - > xmpExtremes("\nNext: Expected Shortfall for Danish Fire Data > ") > fit = gpdFit(danish, nextremes = floor(length(danish)/10), type = "mle") > par(mfrow = c(1, 1)) > tp = gpdtailPlot(fit) > gpdsfallPlot(tp, 0.999) Lower CI Estimate Upper CI 119.0989 270.3280 394.8755 > title(main = "Danish Fire: Expected Shortfall") > > ## gpdriskmeasures - > xmpExtremes("\nNext: Quantiles and Expected Shortfalls > ") > # Give estimates of 0.999 and 0.9999 quantiles - Danish Fire Date: > fit = gpdFit(danish, threshold = 10, type = "mle") > par(mfrow = c(1, 1)) > gpdriskmeasures(fit, c(0.99, 0.995, 0.999, 0.9995, 0.9999)) p quantile sfall 1 0.9900 27.28488 58.21091 2 0.9950 40.16160 83.80091 3 0.9990 94.28956 191.36972 4 0.9995 134.71099 271.69948 5 0.9999 304.62448 609.36958 > > ## gpdshapePlot - > xmpExtremes("\nNext: Shape Plot of Heavy-Tailed Simulated Data > ") > set.seed(4711) > par(mfrow = c(1, 1)) > gpdshapePlot(gpdSim(n = 1000)) > title(sub = "Simulated GPD", cex.sub = 0.7) > > ## gpdshapePlot - > xmpExtremes("\nNext: Shape Plot of Heavy-Tailed Danish Fire Data > ") > par(mfrow = c(1, 1)) > gpdshapePlot(danish) > title(sub = "Danish Fire", cex.sub = 0.7) > > ## gpdtailPlot - > xmpExtremes("\nNext: Plot Tail Estimate of Danish Fire Data >") > fit = gpdFit(danish, threshold = 10, type = "mle") > par(mfrow = c(1, 1)) > gpdtailPlot(fit, main = "Danish Fire: GPD Tail Estimate", col = "steelblue4") > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C3-GpdGlmFit" > > ### * C3-GpdGlmFit > > flush(stderr()); flush(stdout()) > > ### Name: GpdGlmFit > ### Title: Modelling the GPD Distribution including GLM > ### Aliases: GpdGlmFit gpdglmFit print.gpdglmFit plot.gpdglmFit > ### summary.gpdglmFit gpdglmprofPlot gpdglmprofxiPlot > ### Keywords: models > > ### ** Examples > > ## Use Rain Data: > data(rain) > > ## Fit GPD Model: > xmpExtremes("Start: Parameter Estimation >") > fit = gpdglmFit(x = rain, threshold = 10) > print(fit) Call: gpdglmFit(x = rain, threshold = 10) Estimation Type: gpdglm mle Estimated Parameters: sigma mle 7.43736339 0.05049163 > xmpExtremes("Next: Summary Report > ") > > ## Summarize Results: > xmpExtremes("Next: Profile Likelihood >") > par(mfrow = c(2, 2), cex = 0.75) > summary(fit, which = "all") Call: gpdglmFit(x = rain, threshold = 10) Estimation Type: gpdglm mle Estimated Parameters: sigma mle 7.43736339 0.05049163 Standard Deviations: sigma mle 0.23606332 0.02256987 Log-Likelihood Value: 6123.465 Type of Convergence: 0 > # Profile Lielihood: > par(mfrow = c(2, 1), cex = 0.75) > gpdglmprofPlot(fit, m = 10, xlow = 55, xup = 75) If routine fails, try changing plotting interval > title(main = "Rain") > gpdglmprofxiPlot(fit, xlow = -0.02, 0.15) If routine fails, try changing plotting interval > title(main = "Rain") > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C4-PotFit" > > ### * C4-PotFit > > flush(stderr()); flush(stdout()) > > ### Name: PotFit > ### Title: Modelling Peaks Over a Threshold > ### Aliases: PotFit potSim potFit print.potFit plot.potFit summary.potFit > ### Keywords: models > > ### ** Examples > > ## Use Danish Fire Insurance Loss Data: > data(danish) > > ## Fit: > xmpExtremes("\nStart: POT Parameter Estimate >") > fit = potFit(danish, threshold = 10) > print(fit) Call: potFit(x = danish, threshold = 10) Estimation Type: pot mle Estimated Parameters: xi sigma mu beta 0.4971518 1.1611775 -1.6962060 6.9759676 > > ## Summary with Diagnostic Plots: > xmpExtremes("\nNext: Diagnostic Analysis >") > par(mfrow = c(3, 3), cex = 0.5) > summary(fit) Call: potFit(x = danish, threshold = 10) Estimation Type: pot mle Estimated Parameters: xi sigma mu beta 0.4971518 1.1611775 -1.6962060 6.9759676 Standard Deviations: xi sigma mu 0.1358752 0.6887851 3.4377409 Log-Likelihood Value: 876.9955 Type of Convergence: 0 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C5-PPFit" > > ### * C5-PPFit > > flush(stderr()); flush(stdout()) > > ### Name: PPFit > ### Title: Modelling Point Processes > ### Aliases: PPFit ppFit print.ppFit plot.ppFit summary.ppFit > ### Keywords: models > > ### ** Examples > > ## Use Rain Data: > data(rain) > > ## Fit Point Process Model: > xmpExtremes("Start: Parameter Fit for Point Process > ") > fit = ppFit(x = rain[1:200], threshold = 10) > print(fit) Call: ppFit(x = rain[1:200], threshold = 10) Parameter Estimate: xi sigma mu 32.9371305 4.6523414 -0.1348839 > > ## Summarize Results: > xmpExtremes("Next: Diagnostic Analysis > ") > par(mfrow = c(2, 2), cex = 0.75) > summary(fit) Call: ppFit(x = rain[1:200], threshold = 10) Parameter Estimate: xi sigma mu 32.9371305 4.6523414 -0.1348839 Standard Deviations: xi sigma mu 5.4561755 3.1253195 0.2403443 Log-Likelihood Value: 3.182615 Type of Convergence: 0 > xmpExtremes("Next: Interactive Plot > ") > > ## Interactive Plot: > ##> par(mfrow = c(2, 2), cex = 0.75) > ##> plot(fit) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C6-RlargFit" > > ### * C6-RlargFit > > flush(stderr()); flush(stdout()) > > ### Name: RlargFit > ### Title: Modelling the Order Statistic Model > ### Aliases: RlargFit rlargFit print.rlargFit plot.rlargFit > ### summary.rlargFit > ### Keywords: models > > ### ** Examples > > ## Use Venice Data: > data(venice) > > ## Fit for the order statistic model: > xmpExtremes("Start: Parameter Fit for Order Statistics Model > ") > fit = rlargFit(venice[, 2:4], r = 3) > fit Call: rlargFit(x = venice[, 2:4], r = 3) Estimation Type: mle rlarg Estimated Parameters: xi sigma mu -0.09747076 14.84784861 117.31166632 > > ## Summarize Results: > xmpExtremes("Next: Diagnostic Analysis > ") > summary(fit) Call: rlargFit(x = venice[, 2:4], r = 3) Estimation Type: mle rlarg Estimated Parameters: xi sigma mu -0.09747076 14.84784861 117.31166632 Standard Deviations: xi sigma mu 0.04029497 0.93869726 1.81148453 Log-Likelihood Value: 515.3982 Type of Convergence: 0 Hit to see next plot: Hit to see next plot: Hit to see next plot: Hit to see next plot: cleanEx(); ..naHit to see next plot: meEx <- "D1-ExtHit to see next plot: remeIndexPlots" > > > ### * D1-ExtremeIndexPlots > > flush(stderr()); flush(stdout()) > > ### Name: ExtremeIndexPlots > ### Title: Extremal Index Estimation > ### Aliases: ExtremeIndexPlots exindexPlot exindexesPlot > ### Keywords: hplot > > ### ** Examples > > ## Extremal Index for the right and left tails > ## of the BMW log returns: > xmpExtremes("\nStart: Plot the Extremal Index >") > data(bmw) > par(mfrow = c(2, 2), cex = 0.7) > exindexPlot( bmw, block = "quarter") N K un theta2 theta [1,] 5 5 0.08502850 1.0000000 1.0220368 [2,] 6 6 0.07947459 1.0000000 1.0276218 [3,] 8 7 0.07356377 0.8750000 0.9040559 [4,] 10 8 0.06993022 0.8000000 0.8311017 [5,] 11 9 0.06860589 0.8181818 0.8547711 [6,] 12 10 0.06841199 0.8333333 0.8755451 [7,] 13 11 0.06767476 0.8461538 0.8941150 [8,] 15 12 0.06634279 0.8000000 0.8501742 [9,] 16 13 0.06628046 0.8125000 0.8685126 [10,] 17 14 0.06627812 0.8235294 0.8855087 [11,] 20 15 0.05909805 0.7500000 0.8111325 [12,] 21 16 0.05814339 0.7619048 0.8289841 [13,] 23 17 0.05777954 0.7391304 0.8090475 [14,] 24 18 0.05717683 0.7500000 0.8260107 [15,] 26 19 0.05700682 0.7307692 0.8097854 [16,] 28 20 0.05559860 0.7142857 0.7964470 [17,] 29 21 0.05408877 0.7241379 0.8125826 [18,] 31 22 0.05166061 0.7096774 0.8014279 [19,] 32 23 0.05128512 0.7187500 0.8169703 [20,] 33 24 0.05106974 0.7272727 0.8321155 [21,] 35 25 0.05046767 0.7142857 0.8226489 [22,] 38 26 0.04774362 0.6842105 0.7932093 [23,] 39 27 0.04770410 0.6923077 0.8080891 [24,] 40 28 0.04740888 0.7000000 0.8227289 [25,] 42 29 0.04676699 0.6904762 0.8171619 [26,] 43 30 0.04619415 0.6976744 0.8315473 [27,] 44 31 0.04524335 0.7045455 0.8457803 [28,] 46 32 0.04470772 0.6956522 0.8411246 [29,] 47 33 0.04428878 0.7021277 0.8552269 [30,] 53 34 0.04331344 0.6415094 0.7869202 [31,] 62 35 0.04132586 0.5645161 0.6972745 [32,] 64 36 0.04099796 0.5625000 0.7000752 [33,] 65 37 0.04099124 0.5692308 0.7139833 [34,] 67 38 0.04069590 0.5671642 0.7169668 [35,] 68 39 0.04052802 0.5735294 0.7308400 [36,] 69 40 0.04031627 0.5797101 0.7447417 [37,] 71 41 0.04012086 0.5774648 0.7479391 [38,] 73 42 0.04006161 0.5753425 0.7513952 [39,] 79 43 0.03901445 0.5443038 0.7166364 [40,] 81 44 0.03842747 0.5432099 0.7213444 [41,] 84 45 0.03807012 0.5357143 0.7175484 [42,] 89 46 0.03727675 0.5168539 0.6982656 [43,] 90 47 0.03726731 0.5222222 0.7119538 [44,] 92 48 0.03679377 0.5217391 0.7178373 [45,] 93 49 0.03643146 0.5268817 0.7317598 [46,] 95 50 0.03609579 0.5263158 0.7379425 [47,] 97 51 0.03595831 0.5257732 0.7443409 [48,] 99 52 0.03540772 0.5252525 0.7509631 [49,] 101 53 0.03514756 0.5247525 0.7578184 [50,] 103 54 0.03500941 0.5242718 0.7649165 [51,] 104 55 0.03452181 0.5288462 0.7797583 [52,] 107 56 0.03425181 0.5233645 0.7798859 [53,] 111 57 0.03366442 0.5135135 0.7734600 [54,] 123 58 0.03309369 0.4715447 0.7176033 [55,] 142 59 0.03136727 0.4154930 0.6386410 [56,] 148 60 0.03091335 0.4054054 0.6302252 [57,] 152 61 0.03043850 0.4013158 0.6312448 [58,] 153 62 0.03040551 0.4052288 0.6452854 [59,] 159 63 0.03002665 0.3962264 0.6386869 [60,] 165 64 0.02972372 0.3878788 0.6331032 [61,] 168 65 0.02967623 0.3869048 0.6398440 [62,] 174 66 0.02939661 0.3793103 0.6356322 [63,] 181 67 0.02910799 0.3701657 0.6287536 [64,] 182 68 0.02901701 0.3736264 0.6438596 [65,] 183 69 0.02897511 0.3770492 0.6594960 [66,] 193 70 0.02839504 0.3626943 0.6437149 [67,] 194 71 0.02837364 0.3659794 0.6599239 [68,] 198 72 0.02820872 0.3636364 0.6663709 [69,] 200 73 0.02813696 0.3650000 0.6802685 [70,] 204 74 0.02792824 0.3627451 0.6879089 [71,] 208 75 0.02777174 0.3605769 0.6962559 [72,] 221 76 0.02706787 0.3438914 0.6761348 [73,] 227 77 0.02674273 0.3392070 0.6800346 [74,] 232 78 0.02665524 0.3362069 0.6879523 [75,] 233 79 0.02656937 0.3390558 0.7090750 [76,] 267 80 0.02478442 0.2996255 0.6393667 [77,] 273 81 0.02467931 0.2967033 0.6483589 [78,] 299 82 0.02359398 0.2742475 0.6135391 [79,] 312 83 0.02297398 0.2660256 0.6109630 [80,] 319 84 0.02268866 0.2633229 0.6223163 [81,] 326 85 0.02224307 0.2607362 0.6354953 [82,] 342 86 0.02173349 0.2514620 0.6332502 [83,] 344 87 0.02170679 0.2529070 0.6609209 [84,] 373 88 0.02082339 0.2359249 0.6408374 [85,] 403 89 0.02015991 0.2208437 0.6265744 [86,] 407 90 0.02004808 0.2211302 0.6611411 [87,] 412 91 0.01988137 0.2208738 0.7023112 [88,] 442 92 0.01913395 0.2081448 0.7122501 [89,] 455 93 0.01893024 0.2043956 0.7722222 [90,] 556 94 0.01714157 0.1690647 0.7388529 > exindexPlot(-bmw, block = "quarter") N K un theta2 theta [1,] 9 5 0.06955422 0.55555556 0.5676133 [2,] 10 6 0.06887800 0.60000000 0.6163722 [3,] 11 7 0.06807869 0.63636364 0.6573346 [4,] 15 8 0.06519183 0.53333333 0.5538421 [5,] 17 9 0.05806183 0.52941176 0.5528167 [6,] 20 10 0.05561317 0.50000000 0.5249845 [7,] 22 11 0.05525992 0.50000000 0.5279530 [8,] 24 12 0.05188484 0.50000000 0.5309689 [9,] 25 13 0.05084288 0.52000000 0.5554401 [10,] 28 14 0.04957226 0.50000000 0.5371479 [11,] 31 15 0.04880244 0.48387097 0.5228416 [12,] 32 16 0.04845330 0.50000000 0.5435324 [13,] 33 17 0.04743187 0.51515152 0.5634213 [14,] 35 18 0.04688708 0.51428571 0.5658987 [15,] 38 19 0.04609111 0.50000000 0.5535207 [16,] 39 20 0.04565154 0.51282051 0.5712943 [17,] 40 21 0.04541566 0.52500000 0.5885929 [18,] 42 22 0.04525858 0.52380952 0.5909984 [19,] 45 23 0.04466626 0.51111111 0.5803393 [20,] 49 24 0.04328683 0.48979592 0.5596713 [21,] 54 25 0.04194781 0.46296296 0.5323699 [22,] 59 26 0.04148352 0.44067797 0.5100027 [23,] 60 27 0.04122546 0.45000000 0.5243553 [24,] 62 28 0.04071008 0.45161290 0.5298371 [25,] 64 29 0.04001846 0.45312500 0.5352966 [26,] 66 30 0.03984488 0.45454545 0.5407453 [27,] 67 31 0.03973532 0.46268657 0.5543916 [28,] 69 32 0.03938106 0.46376812 0.5596932 [29,] 74 33 0.03859640 0.44594595 0.5419830 [30,] 78 34 0.03744841 0.43589744 0.5336061 [31,] 83 35 0.03668970 0.42168675 0.5199577 [32,] 89 36 0.03511537 0.40449438 0.5023913 [33,] 93 37 0.03490287 0.39784946 0.4978729 [34,] 95 38 0.03474840 0.40000000 0.5044870 [35,] 97 39 0.03465775 0.40206186 0.5111205 [36,] 101 40 0.03412405 0.39603960 0.5074457 [37,] 104 41 0.03378306 0.39423077 0.5092268 [38,] 106 42 0.03360120 0.39622642 0.5160658 [39,] 109 43 0.03353101 0.39449541 0.5181146 [40,] 116 44 0.03236528 0.37931034 0.5022458 [41,] 117 45 0.03232889 0.38461538 0.5137627 [42,] 118 46 0.03225168 0.38983051 0.5253993 [43,] 119 47 0.03221330 0.39495798 0.5371654 [44,] 125 48 0.03123302 0.38400000 0.5268906 [45,] 129 49 0.03051167 0.37984496 0.5259814 [46,] 132 50 0.03012671 0.37878788 0.5294738 [47,] 135 51 0.03004121 0.37777778 0.5331455 [48,] 145 52 0.02913723 0.35862069 0.5107792 [49,] 148 53 0.02896766 0.35810811 0.5151523 [50,] 149 54 0.02895132 0.36241611 0.5267584 [51,] 150 55 0.02892858 0.36666667 0.5385777 [52,] 159 56 0.02800261 0.35220126 0.5225726 [53,] 163 57 0.02764203 0.34969325 0.5244465 [54,] 164 58 0.02732490 0.35365854 0.5363747 [55,] 165 59 0.02710781 0.35757576 0.5485690 [56,] 169 60 0.02695412 0.35502959 0.5509504 [57,] 170 61 0.02688352 0.35882353 0.5635628 [58,] 177 62 0.02659780 0.35028249 0.5566761 [59,] 178 63 0.02652559 0.35393258 0.5696107 [60,] 193 64 0.02606819 0.33160622 0.5399919 [61,] 211 65 0.02505288 0.30805687 0.5076232 [62,] 214 66 0.02485020 0.30841121 0.5150980 [63,] 215 67 0.02476860 0.31162791 0.5278203 [64,] 229 68 0.02392479 0.29694323 0.5097049 [65,] 241 69 0.02356405 0.28630705 0.4983520 [66,] 246 70 0.02337980 0.28455285 0.5027888 [67,] 255 71 0.02308842 0.27843137 0.4994964 [68,] 257 72 0.02295675 0.28015564 0.5108542 [69,] 259 73 0.02273563 0.28185328 0.5227077 [70,] 263 74 0.02272718 0.28136882 0.5309486 [71,] 282 75 0.02185151 0.26595745 0.5103622 [72,] 289 76 0.02169963 0.26297578 0.5140897 [73,] 310 77 0.02111121 0.24838710 0.4944831 [74,] 314 78 0.02092427 0.24840764 0.5047865 [75,] 323 79 0.02060147 0.24458204 0.5076223 [76,] 342 80 0.02019178 0.23391813 0.4959875 [77,] 344 81 0.02014457 0.23546512 0.5114477 [78,] 384 82 0.01930148 0.21354167 0.4742776 [79,] 385 83 0.01929721 0.21558442 0.4920408 [80,] 439 84 0.01832385 0.19134396 0.4475760 [81,] 446 85 0.01821111 0.19058296 0.4597481 [82,] 469 86 0.01775376 0.18336887 0.4567505 [83,] 472 87 0.01772653 0.18432203 0.4764060 [84,] 474 88 0.01765599 0.18565401 0.4999094 [85,] 483 89 0.01745796 0.18426501 0.5191853 [86,] 518 90 0.01687691 0.17374517 0.5144854 [87,] 589 91 0.01559548 0.15449915 0.4837260 [88,] 609 92 0.01520563 0.15106732 0.5094261 [89,] 721 93 0.01341753 0.12898752 0.4759909 [90,] 1024 94 0.01051625 0.09179688 0.3844014 > > ## Extremal Index for the right and left tails > ## of the BMW log returns: > xmpExtremes("\nNext: Investigate Tail Depth Dependence >") > data(bmw) > exindexesPlot( bmw, block = 65) thresholds theta1 theta2 theta3 1 0.04132586 0.7153971 0.5725806 0.5000000 2 0.04296787 0.7924335 0.6363636 0.5454545 3 0.04401281 0.8577933 0.6938776 0.5714286 4 0.04619415 0.8716867 0.7209302 0.5813953 5 0.04789623 0.8576253 0.7297297 0.6216216 6 0.05166061 0.8916387 0.7741935 0.6774194 7 0.05715207 0.8723940 0.7800000 0.7200000 8 0.06158756 0.8587468 0.7894737 0.6842105 9 0.06767476 0.9425858 0.8846154 0.6923077 10 0.07732352 1.0385969 1.0000000 0.7142857 > exindexesPlot(-bmw, block = 65) thresholds theta1 theta2 theta3 1 0.04071008 0.5681169 0.4758065 0.4677419 2 0.04190987 0.5760933 0.4909091 0.5090909 3 0.04328683 0.5496640 0.4795918 0.5714286 4 0.04491698 0.5808093 0.5116279 0.6046512 5 0.04620032 0.5383842 0.4864865 0.5945946 6 0.04880244 0.5450140 0.5000000 0.5806452 7 0.05084288 0.5817480 0.5400000 0.6800000 8 0.05587633 0.6147628 0.5789474 0.6842105 9 0.06611286 0.6845915 0.6538462 0.6923077 10 0.07801705 0.5836084 0.5714286 0.7142857 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "Z1-ExtremesTools" > > ### * Z1-ExtremesTools > > flush(stderr()); flush(stdout()) > > ### Name: ExtremesTools > ### Title: fExtremes Tools > ### Aliases: ExtremesTools xmpExtremes xmpfExtremes > ### Keywords: programming > > ### ** Examples > > ## Not run: > ##D ## xmpfExtremes - > ##D # Popup the examples menu: > ##D xmpfExtremes() > ## End(Not run) > > > > ### *