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("fBasics-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('fBasics') Rmetrics, (C) 1999-2005, Diethelm Wuertz, GPL fBasics: Markets, Basic Statistics, Date and Time > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "A0-SPlusCompatibility" > > ### * A0-SPlusCompatibility > > flush(stderr()); flush(stdout()) > > ### Name: SPlusCompatibility > ### Title: R Functions for SPlus Compatibility > ### Aliases: SPlusCompatibility > ### Keywords: programming > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > > > > cleanEx(); ..nameEx <- "A1-WebDataImport" > > ### * A1-WebDataImport > > flush(stderr()); flush(stdout()) > > ### Name: WebDataImport > ### Title: Import Market Data from the Internet > ### Aliases: WebDataImport fWEBDATA fWEBDATA-class show.fWEBDATA > ### show,fWEBDATA-method economagicImport yahooImport fredImport > ### keystatsImport print.keystats > ### Keywords: data > > ### ** Examples > > ## Not run: > ##D ## SOURCE("fBasics.A0-SPlusCompatibility") > ##D ## SOURCE("fBasics.A1-WebDataImport") > ##D > ##D ## economagicImport - > ##D xmpBasics("\nStart: Daily Foreign Exchange Rates > ") > ##D USDEUR = economagicImport(query = "fedny/day-fxus2eu", > ##D frequency = "daily", colname = "USDEUR") > ##D # Print Data Slot if Internet Download was Successful: > ##D if (!is.null(USDEUR)) print(USDEUR@data[1:20, ]) > ##D > ##D ## economagicImport - > ##D xmpBasics("\nNext: USFEDFUNDS Monthly US FedFunds Rates > ") > ##D USFEDFUNDS = economagicImport(query = "fedstl/fedfunds+2", > ##D frequency = "monthly", colname = "USFEDFUNDS") > ##D if (!is.null(USFEDFUNDS)) print(USFEDFUNDS@data[1:20, ]) > ##D > ##D ## economagicImport - > ##D xmpBasics("\nNext: USDGNP Quarterly GNP Data Records > ") > ##D USGNP = economagicImport(query = "fedstl/gnp", > ##D frequency = "quarterly", colname = "USGNP") > ##D if(!is.null(USGNP)) print(USGNP@data[1:20, ]) > ##D > ##D ## yahooImport - > ##D xmpBasics("\nNext: IBM Shares from Yahoo > ") > ##D # [test 19/20 century change 01-12-1999 -- 31-01-2000] > ##D query = "s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv" > ##D IBM = yahooImport(query) > ##D if (!is.null(IBM)) print(IBM@data[1:20, ]) > ##D > ##D ## keystatsImport - > ##D xmpBasics("\nNext: Key Statistics IBM Shares from Yahoo > ") > ##D keystatsImport("IBM") > ##D > ##D ## fredImport - > ##D xmpBasics("\nNext: DPRIME Daily Bank Prime Load Rate Records > ") > ##D DPRIME = fredImport("DPRIME") > ##D if (!is.null(DPRIME)) print(DPRIME@data[1:20, ]) > ## End(Not run) > > > > cleanEx(); ..nameEx <- "A2-BasicStatistics" > > ### * A2-BasicStatistics > > flush(stderr()); flush(stdout()) > > ### Name: BasicStatistics > ### Title: Basic Statistics Summary > ### Aliases: BasicStatistics basicStats skewness skewness.default > ### skewness.data.frame skewness.POSIXct skewness.POSIXlt kurtosis > ### kurtosis.default kurtosis.data.frame kurtosis.POSIXct > ### kurtosis.POSIXlt rowStats rowAvgs rowVars rowStdevs rowSkewness > ### rowKurtosis rowCumsums colStats colAvgs colVars colStdevs colSkewness > ### colKurtosis colCumsums stdev > ### Keywords: univar > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.A2-BasicStatistics") > > ## basicStats - > xmpBasics("\nStart: Basic Statistics of log-Returns > ") > # Data NYSE Composite Index: > data(nyseres) > basicStats(nyseres) Warning in basicStats(nyseres) : Column 1 of data.frame used Value nobs 8.390000e+03 NAs 0.000000e+00 Minimum -2.128592e-01 Maximum 8.622183e-02 1. Quartile -3.974226e-03 3. Quartile 4.713271e-03 Mean 3.031350e-04 Median 4.265080e-04 Sum 2.543303e+00 SE Mean 9.489133e-05 LCL Mean 1.171246e-04 UCL Mean 4.891455e-04 Variance 7.554662e-05 Stdev 8.691756e-03 Skewness -1.922222e+00 Kurtosis 4.815893e+01 > > ## mean - > ## var - > ## skewness - > ## kurtosis - > xmpBasics("\nNext: Moments, Skewness and Kurtosis > ") > # Mean, Variance: > mean(nyseres) NYSERES 0.0003031350 > var(nyseres) NYSERES NYSERES 7.554662e-05 > # Skewness, Kurtosis: > class(nyseres) [1] "data.frame" > skewness(nyseres[, 1]) [1] -1.922222 > kurtosis(nyseres[, 1]) [1] 48.15893 > > > > cleanEx(); ..nameEx <- "A3-BasicPlots" > > ### * A3-BasicPlots > > flush(stderr()); flush(stdout()) > > ### Name: BasicPlots > ### Title: Basic Plot Functions and Utilities > ### Aliases: BasicPlots tsPlot histPlot densityPlot circlesPlot perspPlot > ### characterTable plotcharacterTable colorTable splusLikePlot > ### Keywords: hplot > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.A3-BasicPlots") > > ## Not run: > ##D ## tsPlot - > ##D xmpBasics("\nStart: European Stock Markets > ") > ##D # Show multiple plot: > ##D par(mfrow = c(1, 1), cex = 0.7) > ##D data(DowJones30) > ##D DowJones.ts = as.timeSeries(DowJones30)[, c("CAT", "GE", "IBM", "JPM", )] > ##D tsPlot(DowJones.ts) > ##D title(main = "CAT - GE - IBM - JPM") > ##D > ##D ## histPlot - > ##D xmpBasics("\nNext: Histogram Plot of Normal Random Numbers > ") > ##D DowJones.ret = returnSeries(DowJones.ts) > ##D par(mfrow = c(2, 2), cex = 0.7) > ##D histPlot(x = DowJones.ret) > ##D > ##D ## densityPlot - > ##D xmpBasics("\nNext: Density Plot of Normal Random Numbers > ") > ##D densityPlot(x = DowJones.ret) > ##D > ##D ## circlesPlot - > ##D xmpBasics("\nNext: 3D Circles Plot of Normal Random Numbers > ") > ##D par(mfrow = c(1, 1), cex = 0.7) > ##D circlesPlot(x = rnorm(50), y = rnorm(50), size = abs(rnorm(50)), > ##D main = "Circles Plot") > ##D > ##D ## perspPlot - > ##D xmpBasics("\nNext: Perspective Plot > ") > ##D par(mfrow = c(1, 1)) > ##D x = y = seq(-10, 10, length = 51) > ##D f = function(x, y) { r = sqrt(x^2+y^2); 10 * sin(r)/r } > ##D z = outer(x, y, f) > ##D perspPlot(x, y, z) > ##D title(main = "Perspective Plot", line = -3) > ##D > ##D ## characterTable - > ##D xmpBasics("\nNext: Print the Copyright Sign > ") > ##D cat("\251 \n") > ##D > ##D ## characterTable - > ##D xmpBasics("\nNext: Display Character Table for Symbol Font > ") > ##D characterTable(5) > ##D > ##D ## colorTable - > ##D xmpBasics("\nNext: Display Table of Plot Colors > ") > ##D colorTable() > ##D > ##D ## plotcharacter Table - > ##D xmpBasics("\nNext: Display Table of Plot Characters > ") > ##D plotcharacterTable() > ## End(Not run) > > > > cleanEx(); ..nameEx <- "B1-HyperbolicDistribution" > > ### * B1-HyperbolicDistribution > > flush(stderr()); flush(stdout()) > > ### Name: HyperbolicDistribution > ### Title: Generalized Hyperbolic Distribution > ### Aliases: HyperbolicDistribution dgh pgh qgh rgh dhyp phyp qhyp rhyp > ### hypMode dnig pnig qnig rnig > ### Keywords: distribution > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.B1-HyperbolicDistribution") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## gh - > > ## hyp - > xmpBasics("\nStart: Hyperbolic Distribution > ") > par(mfcol = c(3, 2), cex = 0.5) > set.seed(1953) > r = rhyp(1000, alpha = 1, beta = 0.3, delta = 1) > plot(r, type = "l", col = "steelblue4", + main = "hyp: alpha=1 beta=0.3 delta=1") > # Plot empirical density and compare with true density: > hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") > x = seq(-5, 5, 0.25) > lines(x, dhyp(x, alpha = 1, beta = 0.3, delta = 1)) > # Plot df and compare with true df: > plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4") > lines(x, phyp(x, alpha = 1, beta = 0.3, delta = 1)) > # Compute quantiles: > qhyp(phyp(seq(-5, 7, 1), alpha = 1, beta = 0.3, delta = 1), + alpha = 1, beta = 0.3, delta = 1) [1] -5.000017e+00 -3.999997e+00 -3.000000e+00 -2.000023e+00 -1.000003e+00 [6] -2.344483e-06 1.000000e+00 2.000000e+00 2.999997e+00 3.999989e+00 [11] 5.000002e+00 6.000003e+00 7.000001e+00 attr(,"param") alpha beta delta mu 1.0 0.3 1.0 0.0 > # Compute the mode: > hypMode(alpha = 1, beta = 0.3, delta = 1) [1] 0.3144855 attr(,"param") alpha beta delta mu 1.0 0.3 1.0 0.0 > > > ## nig - > xmpBasics("\nNext: Normal Inverse Gaussian Distribution > ") > set.seed(1953) > r = rnig(5000, alpha = 1, beta = 0.3, delta = 1) > plot(r, type = "l", col = "steelblue4", + main = "nig: alpha=1 beta=0.3 delta=1") > # Plot empirical density and compare with true density: > hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") > x = seq(-5, 5, 0.25) > lines(x, dnig(x, alpha = 1, beta = 0.3, delta = 1)) > # Plot df and compare with true df: > plot(sort(r), (1:5000/5000), main = "Probability", col = "steelblue4") > lines(x, pnig(x, alpha = 1, beta = 0.3, delta = 1)) > # Compute Quantiles: > qnig(pnig(seq(-5, 5, 1), alpha = 1, beta = 0.3, delta = 1), + alpha = 1, beta = 0.3, delta = 1) [1] -5.000001e+00 -4.000000e+00 -3.000006e+00 -1.999996e+00 -1.000010e+00 [6] -8.504243e-06 1.000003e+00 1.999972e+00 3.000000e+00 3.999998e+00 [11] 4.999976e+00 attr(,"param") alpha beta delta mu lambda 1.0 0.3 1.0 0.0 -0.5 > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B2-StableDistribution" > > ### * B2-StableDistribution > > flush(stderr()); flush(stdout()) > > ### Name: StableDistribution > ### Title: Stable Distribution Function > ### Aliases: StableDistribution dsymstb psymstb qsymstb rsymstb stableMode > ### dstable pstable qstable rstable > ### Keywords: distribution > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.B2-StableDistribution") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## rsymstb - > xmpBasics("\nStart: Symmetric Stable Distribuion: > ") > par(mfcol = c(3, 2), cex = 0.7) > set.seed(1953) > r = rsymstb(n = 1000, alpha = 1.9) > plot(r, type = "l", main = "symstb: alpha = 1.9") > # Plot empirical density and compare with true density: > hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") > x = seq(-5, 5, 0.1) > lines(x, dsymstb(x = x, alpha = 1.9)) > # Plot df and compare with true df: > plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4") > lines(x, psymstb(x, alpha = 1.9)) > # Compute quantiles: > qsymstb(psymstb(q = seq(-10, 10, 1), alpha = 1.9), alpha = 1.9) [1] -10.000000 -9.000005 -8.000000 -6.999985 -6.000014 -4.999999 [7] -4.000000 -3.000000 -1.999997 -1.000000 0.000000 1.000000 [13] 1.999997 3.000000 4.000000 4.999997 5.999992 7.000000 [19] 8.000000 9.000000 10.000000 > > ## stable - > xmpBasics("\nNext: Skew Stable Distribuion: > ") > # Compared to R, this might be quite slow under S-Plus ... > set.seed(1953) > r = rstable(n = 1000, alpha = 1.9, beta = 0.3) > plot(r, type = "l", main = "stable: alpha=1.9 beta=0.3") > # Plot empirical density and compare with true density: > hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") > x = seq(-5, 5, 0.4) > lines(x, dstable(x = x, alpha = 1.9, beta = 0.3)) > # Plot df and compare with true df: > plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4") > lines(x, pstable(q = x, alpha = 1.9, beta = 0.3)) > # Compute quantiles: > qstable(pstable(seq(-4, 4, 1), alpha = 1.9, beta = 0.3), + alpha = 1.9, beta = 0.3) [1] -4.000020e+00 -3.000005e+00 -2.000000e+00 -1.000002e+00 1.178536e-08 [6] 1.000000e+00 1.999998e+00 3.000002e+00 4.000000e+00 > > ## stable - > xmpBasics("\nNext: Paramterization S1: > ") > set.seed(1953) > r = rstable(n = 1000, alpha = 1.9, beta = 0.3, pm = 1) > plot(r, type = "l", main = "S1 stable: alpha=1.9 beta=0.3") > # Plot empirical density and compare with true density: > hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") > x = seq(-5, 5, 0.4) > lines(x, dstable(x = x, alpha = 1.9, beta = 0.3)) > # Plot df and compare with true df: > plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4") > lines(x, pstable(q = x, alpha = 1.9, beta = 0.3, pm = 1)) > # Compute quantiles: > qstable(pstable(seq(-4, 4, 1), alpha = 1.9, beta = 0.3, pm = 1), + alpha = 1.9, beta = 0.3, pm = 1) [1] -4.000012e+00 -3.000010e+00 -2.000000e+00 -1.000001e+00 4.704052e-07 [6] 1.000002e+00 1.999996e+00 3.000006e+00 3.999999e+00 > > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "B3-SmoothedSplineDistribution" > > ### * B3-SmoothedSplineDistribution > > flush(stderr()); flush(stdout()) > > ### Name: SmoothedSplineDistribution > ### Title: Smoothed Spline Distribution > ### Aliases: SmoothedSplineDistribution dssd pssd qssd rssd > ### Keywords: distribution > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.B3-SmoothedSplineDistribution") > ## SOURCE("fBasics.B4-DistributionFits") > > ## ssd - > ## Not run: > ##D xmpBasics("\nStart: Spline Smoothed Distribution > ") > ##D par(mfcol = c(2, 1), cex = 0.5) > ##D set.seed(1953) > ##D x = rnorm(1000) > ##D param = ssdFit(x) > ##D # Plot empirical density and compare with fitted density: > ##D hist(x, n = 25, probability = TRUE, border = "white", col = "steelblue4") > ##D s = seq(min(x), max(x), 0.1) > ##D lines(s, dssd(s, param), lwd = 2) > ##D # Plot df and compare with true df: > ##D plot(sort(x), (1:1000/1000), main = "Probability", col = "steelblue4") > ##D lines(s, pssd(s, param), lwd = 2) > ##D # Compute quantiles: > ##D qssd(pssd(seq(-3, 3, 1), param), param) > ## End(Not run) > > > > cleanEx(); ..nameEx <- "B4-DistributionFits" > > ### * B4-DistributionFits > > flush(stderr()); flush(stdout()) > > ### Name: DistributionFits > ### Title: Parameter Fit of a Distribution > ### Aliases: DistributionFits fDISTFIT fDISTFIT-class tFit ghFit hypFit > ### nigFit print.fDISTFIT ssdFit print.ssd > ### Keywords: distribution > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.B1-HyperbolicDistribution") > ## SOURCE("fBasics.B3-SmoothedSplineDistribution") > ## SOURCE("fBasics.B4-DistributionFits") > > ## tFit - > xmpBasics("\nStart: MLE Fit to Student's t Density > ") > par(mfrow = c(2,2), cex = 0.7, err = -1) > options(warn = -1) > # Simulated random variates t(4): > set.seed(1953) > s = rt(n = 1000, df = 4) > # Note, this may take some time. > # Starting vector: > df.startvalue = 2*var(s)/(var(s)-1) > tFit(s, df.startvalue, doplot = TRUE) Optimization Step: 1 Objective Function Value: -1665.93 Students df Estimate: 3.978585 Optimization Step: 2 Objective Function Value: -1665.93 Students df Estimate: 3.978585 Optimization Step: 3 Objective Function Value: -1665.93 Students df Estimate: 3.978589 Optimization Step: 4 Objective Function Value: -1668.107 Students df Estimate: 3.175611 Optimization Step: 5 Objective Function Value: -1665.885 Students df Estimate: 3.886849 Optimization Step: 6 Objective Function Value: -1665.885 Students df Estimate: 3.886853 Optimization Step: 7 Objective Function Value: -1665.883 Students df Estimate: 3.861322 Optimization Step: 8 Objective Function Value: -1665.883 Students df Estimate: 3.861326 Optimization Step: 9 Objective Function Value: -1665.883 Students df Estimate: 3.86277 Optimization Step: 10 Objective Function Value: -1665.883 Students df Estimate: 3.862774 Title: Student-t Parameter Estimation Call: tFit(x = s, df = df.startvalue, doplot = TRUE) Model: Student-t Distribution Estimated Parameter(s): df 3.86277 Description: Wed Jul 13 14:04:23 2005 > > ## ghFit - > > ## hypFit - > xmpBasics("\nNext: MLE Fit to Hyperbolic Density > ") > # Simulated random variates HYP(1, 0.3, 1, -1): > set.seed(1953) > s = rhyp(n = 1000, alpha = 1.5, beta = 0.3, delta = 0.5, mu = -1) > # Note, this may take some time. > # Starting vector (1, 0, 1, mean(s)): > hypFit(s, alpha = 1, beta = 0, delta = 1, mu = mean(s), + doplot = TRUE, width = 0.5) Optimization Step: 1 Objective Function Value: -1559.734 Parameter Estimates: 1 0 1 -0.6991407 Optimization Step: 2 Objective Function Value: -1559.734 Parameter Estimates: 1 0 1 -0.6991407 Optimization Step: 3 Objective Function Value: -1559.734 Parameter Estimates: 1.000001 0 1 -0.6991407 Optimization Step: 4 Objective Function Value: -1559.734 Parameter Estimates: 1 1e-06 1 -0.6991407 Optimization Step: 5 Objective Function Value: -1559.734 Parameter Estimates: 1 0 1.000001 -0.6991407 Optimization Step: 6 Objective Function Value: -1559.734 Parameter Estimates: 1 0 1 -0.6991397 Optimization Step: 7 Objective Function Value: NaN Parameter Estimates: 326.2445 -0.001351964 -99.0397 -24.09649 Optimization Step: 8 Objective Function Value: NaN Parameter Estimates: 33.52445 -0.0001351964 -9.00397 -3.038876 Optimization Step: 9 Objective Function Value: NaN Parameter Estimates: 4.252445 -1.351964e-05 -0.0003969828 -0.9331142 Optimization Step: 10 Objective Function Value: -1481.944 Parameter Estimates: 1.325245 -1.351964e-06 0.8999603 -0.722538 Optimization Step: 11 Objective Function Value: -1481.944 Parameter Estimates: 1.325246 -1.351964e-06 0.8999603 -0.722538 Optimization Step: 12 Objective Function Value: -1481.944 Parameter Estimates: 1.325245 -3.519639e-07 0.8999603 -0.722538 Optimization Step: 13 Objective Function Value: -1481.944 Parameter Estimates: 1.325245 -1.351964e-06 0.8999613 -0.722538 Optimization Step: 14 Objective Function Value: -1481.944 Parameter Estimates: 1.325245 -1.351964e-06 0.8999603 -0.722537 Optimization Step: 15 Objective Function Value: -1461.587 Parameter Estimates: 1.524322 0.06213908 0.7727643 -0.754707 Optimization Step: 16 Objective Function Value: -1461.587 Parameter Estimates: 1.524324 0.06213908 0.7727643 -0.754707 Optimization Step: 17 Objective Function Value: -1461.587 Parameter Estimates: 1.524322 0.06214008 0.7727643 -0.754707 Optimization Step: 18 Objective Function Value: -1461.587 Parameter Estimates: 1.524322 0.06213908 0.7727653 -0.754707 Optimization Step: 19 Objective Function Value: -1461.587 Parameter Estimates: 1.524322 0.06213908 0.7727643 -0.754706 Optimization Step: 20 Objective Function Value: -1465.527 Parameter Estimates: 1.632852 0.04161639 0.6758528 -0.878139 Optimization Step: 21 Objective Function Value: -1459.285 Parameter Estimates: 1.565029 0.05444162 0.7364156 -0.8010027 Optimization Step: 22 Objective Function Value: -1459.285 Parameter Estimates: 1.565030 0.05444162 0.7364156 -0.8010027 Optimization Step: 23 Objective Function Value: -1459.285 Parameter Estimates: 1.565029 0.05444262 0.7364156 -0.8010027 Optimization Step: 24 Objective Function Value: -1459.285 Parameter Estimates: 1.565029 0.05444162 0.7364166 -0.8010027 Optimization Step: 25 Objective Function Value: -1459.285 Parameter Estimates: 1.565029 0.05444162 0.7364156 -0.8010017 Optimization Step: 26 Objective Function Value: -1457.453 Parameter Estimates: 1.603024 0.1083267 0.6831887 -0.8361081 Optimization Step: 27 Objective Function Value: -1457.453 Parameter Estimates: 1.603026 0.1083267 0.6831887 -0.8361081 Optimization Step: 28 Objective Function Value: -1457.453 Parameter Estimates: 1.603024 0.1083277 0.6831887 -0.8361081 Optimization Step: 29 Objective Function Value: -1457.453 Parameter Estimates: 1.603024 0.1083267 0.6831897 -0.8361081 Optimization Step: 30 Objective Function Value: -1457.453 Parameter Estimates: 1.603024 0.1083267 0.6831887 -0.8361071 Optimization Step: 31 Objective Function Value: -1456.137 Parameter Estimates: 1.602150 0.1668602 0.643781 -0.8849956 Optimization Step: 32 Objective Function Value: -1456.137 Parameter Estimates: 1.602152 0.1668602 0.643781 -0.8849956 Optimization Step: 33 Objective Function Value: -1456.137 Parameter Estimates: 1.602150 0.1668612 0.643781 -0.8849956 Optimization Step: 34 Objective Function Value: -1456.137 Parameter Estimates: 1.602150 0.1668602 0.643782 -0.8849956 Optimization Step: 35 Objective Function Value: -1456.137 Parameter Estimates: 1.602150 0.1668602 0.643781 -0.8849946 Optimization Step: 36 Objective Function Value: -1455.129 Parameter Estimates: 1.572097 0.2524315 0.5869935 -0.9642195 Optimization Step: 37 Objective Function Value: -1455.129 Parameter Estimates: 1.572099 0.2524315 0.5869935 -0.9642195 Optimization Step: 38 Objective Function Value: -1455.129 Parameter Estimates: 1.572097 0.2524325 0.5869935 -0.9642195 Optimization Step: 39 Objective Function Value: -1455.129 Parameter Estimates: 1.572097 0.2524315 0.5869945 -0.9642195 Optimization Step: 40 Objective Function Value: -1455.129 Parameter Estimates: 1.572097 0.2524315 0.5869935 -0.9642185 Optimization Step: 41 Objective Function Value: -1454.975 Parameter Estimates: 1.561319 0.2434009 0.582427 -0.9603986 Optimization Step: 42 Objective Function Value: -1454.975 Parameter Estimates: 1.561320 0.2434009 0.582427 -0.9603986 Optimization Step: 43 Objective Function Value: -1454.975 Parameter Estimates: 1.561319 0.2434019 0.582427 -0.9603986 Optimization Step: 44 Objective Function Value: -1454.975 Parameter Estimates: 1.561319 0.2434009 0.582428 -0.9603986 Optimization Step: 45 Objective Function Value: -1454.975 Parameter Estimates: 1.561319 0.2434009 0.582427 -0.9603976 Optimization Step: 46 Objective Function Value: -1454.426 Parameter Estimates: 1.490005 0.204524 0.5276716 -0.9417439 Optimization Step: 47 Objective Function Value: -1454.426 Parameter Estimates: 1.490007 0.204524 0.5276716 -0.9417439 Optimization Step: 48 Objective Function Value: -1454.426 Parameter Estimates: 1.490005 0.204525 0.5276716 -0.9417439 Optimization Step: 49 Objective Function Value: -1454.426 Parameter Estimates: 1.490005 0.204524 0.5276726 -0.9417439 Optimization Step: 50 Objective Function Value: -1454.426 Parameter Estimates: 1.490005 0.204524 0.5276716 -0.9417429 Optimization Step: 51 Objective Function Value: -1454.145 Parameter Estimates: 1.461523 0.1958678 0.4787552 -0.9365758 Optimization Step: 52 Objective Function Value: -1454.145 Parameter Estimates: 1.461524 0.1958678 0.4787552 -0.9365758 Optimization Step: 53 Objective Function Value: -1454.145 Parameter Estimates: 1.461523 0.1958688 0.4787552 -0.9365758 Optimization Step: 54 Objective Function Value: -1454.145 Parameter Estimates: 1.461523 0.1958678 0.4787562 -0.9365758 Optimization Step: 55 Objective Function Value: -1454.145 Parameter Estimates: 1.461523 0.1958678 0.4787552 -0.9365748 Optimization Step: 56 Objective Function Value: -1453.724 Parameter Estimates: 1.399456 0.1835261 0.3386050 -0.9179414 Optimization Step: 57 Objective Function Value: -1453.724 Parameter Estimates: 1.399457 0.1835261 0.3386050 -0.9179414 Optimization Step: 58 Objective Function Value: -1453.724 Parameter Estimates: 1.399456 0.1835271 0.3386050 -0.9179414 Optimization Step: 59 Objective Function Value: -1453.724 Parameter Estimates: 1.399456 0.1835261 0.3386060 -0.9179414 Optimization Step: 60 Objective Function Value: -1453.724 Parameter Estimates: 1.399456 0.1835261 0.3386050 -0.9179404 Optimization Step: 61 Objective Function Value: -1453.685 Parameter Estimates: 1.423064 0.1915737 0.3669318 -0.9218226 Optimization Step: 62 Objective Function Value: -1453.685 Parameter Estimates: 1.423065 0.1915737 0.3669318 -0.9218226 Optimization Step: 63 Objective Function Value: -1453.685 Parameter Estimates: 1.423064 0.1915747 0.3669318 -0.9218226 Optimization Step: 64 Objective Function Value: -1453.685 Parameter Estimates: 1.423064 0.1915737 0.3669328 -0.9218226 Optimization Step: 65 Objective Function Value: -1453.685 Parameter Estimates: 1.423064 0.1915737 0.3669318 -0.9218216 Optimization Step: 66 Objective Function Value: -1453.683 Parameter Estimates: 1.420480 0.1913253 0.3647821 -0.9200177 Optimization Step: 67 Objective Function Value: -1453.683 Parameter Estimates: 1.420482 0.1913253 0.3647821 -0.9200177 Optimization Step: 68 Objective Function Value: -1453.683 Parameter Estimates: 1.420480 0.1913263 0.3647821 -0.9200177 Optimization Step: 69 Objective Function Value: -1453.683 Parameter Estimates: 1.420480 0.1913253 0.3647831 -0.9200177 Optimization Step: 70 Objective Function Value: -1453.683 Parameter Estimates: 1.420480 0.1913253 0.3647821 -0.9200167 Optimization Step: 71 Objective Function Value: -1453.683 Parameter Estimates: 1.420290 0.1913981 0.3635324 -0.9202384 Optimization Step: 72 Objective Function Value: -1453.683 Parameter Estimates: 1.420292 0.1913981 0.3635324 -0.9202384 Optimization Step: 73 Objective Function Value: -1453.683 Parameter Estimates: 1.420290 0.1913991 0.3635324 -0.9202384 Optimization Step: 74 Objective Function Value: -1453.683 Parameter Estimates: 1.420290 0.1913981 0.3635334 -0.9202384 Optimization Step: 75 Objective Function Value: -1453.683 Parameter Estimates: 1.420290 0.1913981 0.3635324 -0.9202374 Optimization Step: 76 Objective Function Value: -1453.683 Parameter Estimates: 1.420337 0.1913533 0.3637454 -0.9202082 Optimization Step: 77 Objective Function Value: -1453.683 Parameter Estimates: 1.420338 0.1913533 0.3637454 -0.9202082 Optimization Step: 78 Objective Function Value: -1453.683 Parameter Estimates: 1.420337 0.1913543 0.3637454 -0.9202082 Optimization Step: 79 Objective Function Value: -1453.683 Parameter Estimates: 1.420337 0.1913533 0.3637464 -0.9202082 Optimization Step: 80 Objective Function Value: -1453.683 Parameter Estimates: 1.420337 0.1913533 0.3637454 -0.9202072 Optimization Step: 81 Objective Function Value: -1453.683 Parameter Estimates: 1.420333 0.1913645 0.3637407 -0.9202176 Optimization Step: 82 Objective Function Value: -1453.683 Parameter Estimates: 1.420335 0.1913645 0.3637407 -0.9202176 Optimization Step: 83 Objective Function Value: -1453.683 Parameter Estimates: 1.420333 0.1913655 0.3637407 -0.9202176 Optimization Step: 84 Objective Function Value: -1453.683 Parameter Estimates: 1.420333 0.1913645 0.3637417 -0.9202176 Optimization Step: 85 Objective Function Value: -1453.683 Parameter Estimates: 1.420333 0.1913645 0.3637407 -0.9202166 Title: Hyperbolic Parameter Estimation Call: hypFit(x = s, alpha = 1, beta = 0, delta = 1, mu = mean(s), doplot = TRUE, width = 0.5) Model: Hyperbolic Distribution Estimated Parameter(s): alpha beta delta mu 1.4203334 0.1913645 0.3637407 -0.9202176 Description: Wed Jul 13 14:04:23 2005 > > ## nigFit - > xmpBasics("\nNext: MLE Fit to Normal Inverse Gaussian Density > ") > # Simulated random variates HYP(1.5, 0.3, 0.5, -1.0): > set.seed(1953) > s = rnig(n = 1000, alpha = 1.5, beta = 0.3, delta = 0.5, mu = -1.0) > # Note, this may take some time. > # Starting vector (1, 0, 1, mean(s)): > nigFit(s, alpha = 1, beta = 0, delta = 1, mu = mean(s), doplot = TRUE) Optimization Step: 1 Objective Function Value: -975.631 Parameter Estimates: 1 0 1 -0.9143356 Optimization Step: 2 Objective Function Value: -975.631 Parameter Estimates: 1 0 1 -0.9143356 Optimization Step: 3 Objective Function Value: -975.631 Parameter Estimates: 1.000001 0 1 -0.9143356 Optimization Step: 4 Objective Function Value: -975.631 Parameter Estimates: 1 1e-06 1 -0.9143356 Optimization Step: 5 Objective Function Value: -975.6314 Parameter Estimates: 1 0 1.000001 -0.9143356 Optimization Step: 6 Objective Function Value: -975.6311 Parameter Estimates: 1 0 1 -0.9143346 Optimization Step: 7 Objective Function Value: -843.94 Parameter Estimates: 1.171756 -4.997673e-07 0.6621889 -0.9892168 Optimization Step: 8 Objective Function Value: -843.94 Parameter Estimates: 1.171757 -4.997673e-07 0.6621889 -0.9892168 Optimization Step: 9 Objective Function Value: -843.94 Parameter Estimates: 1.171756 5.002327e-07 0.6621889 -0.9892168 Optimization Step: 10 Objective Function Value: -843.9403 Parameter Estimates: 1.171756 -4.997673e-07 0.6621899 -0.9892168 Optimization Step: 11 Objective Function Value: -843.9399 Parameter Estimates: 1.171756 -4.997673e-07 0.6621889 -0.9892158 Optimization Step: 12 Objective Function Value: -833.2156 Parameter Estimates: 1.277484 0.07709275 0.2992988 -0.9119143 Optimization Step: 13 Objective Function Value: -833.2157 Parameter Estimates: 1.277485 0.07709275 0.2992988 -0.9119143 Optimization Step: 14 Objective Function Value: -833.2156 Parameter Estimates: 1.277484 0.07709375 0.2992988 -0.9119143 Optimization Step: 15 Objective Function Value: -833.215 Parameter Estimates: 1.277484 0.07709275 0.2992998 -0.9119143 Optimization Step: 16 Objective Function Value: -833.2161 Parameter Estimates: 1.277484 0.07709275 0.2992988 -0.9119133 Optimization Step: 17 Objective Function Value: -823.9605 Parameter Estimates: 1.217894 0.2631786 0.4329216 -1.145093 Optimization Step: 18 Objective Function Value: -823.9605 Parameter Estimates: 1.217895 0.2631786 0.4329216 -1.145093 Optimization Step: 19 Objective Function Value: -823.9604 Parameter Estimates: 1.217894 0.2631796 0.4329216 -1.145093 Optimization Step: 20 Objective Function Value: -823.9605 Parameter Estimates: 1.217894 0.2631786 0.4329226 -1.145093 Optimization Step: 21 Objective Function Value: -823.9598 Parameter Estimates: 1.217894 0.2631786 0.4329216 -1.145092 Optimization Step: 22 Objective Function Value: -941.5623 Parameter Estimates: 1.411531 0.3414651 0.8778166 -0.8775756 Optimization Step: 23 Objective Function Value: -809.0634 Parameter Estimates: 1.277896 0.2874369 0.5707793 -1.062198 Optimization Step: 24 Objective Function Value: -809.0634 Parameter Estimates: 1.277897 0.2874369 0.5707793 -1.062198 Optimization Step: 25 Objective Function Value: -809.0634 Parameter Estimates: 1.277896 0.2874379 0.5707793 -1.062198 Optimization Step: 26 Objective Function Value: -809.0637 Parameter Estimates: 1.277896 0.2874369 0.5707803 -1.062198 Optimization Step: 27 Objective Function Value: -809.0633 Parameter Estimates: 1.277896 0.2874369 0.5707793 -1.062197 Optimization Step: 28 Objective Function Value: -789.2918 Parameter Estimates: 1.302586 0.3000669 0.4687753 -1.046870 Optimization Step: 29 Objective Function Value: -789.2917 Parameter Estimates: 1.302587 0.3000669 0.4687753 -1.046870 Optimization Step: 30 Objective Function Value: -789.2917 Parameter Estimates: 1.302586 0.3000679 0.4687753 -1.046870 Optimization Step: 31 Objective Function Value: -789.2919 Parameter Estimates: 1.302586 0.3000669 0.4687763 -1.046870 Optimization Step: 32 Objective Function Value: -789.2917 Parameter Estimates: 1.302586 0.3000669 0.4687753 -1.046869 Optimization Step: 33 Objective Function Value: -788.0665 Parameter Estimates: 1.287367 0.3425779 0.3558983 -1.029460 Optimization Step: 34 Objective Function Value: -788.0665 Parameter Estimates: 1.287368 0.3425779 0.3558983 -1.029460 Optimization Step: 35 Objective Function Value: -788.0665 Parameter Estimates: 1.287367 0.3425789 0.3558983 -1.029460 Optimization Step: 36 Objective Function Value: -788.0663 Parameter Estimates: 1.287367 0.3425779 0.3558993 -1.029460 Optimization Step: 37 Objective Function Value: -788.0665 Parameter Estimates: 1.287367 0.3425779 0.3558983 -1.029459 Optimization Step: 38 Objective Function Value: -784.5939 Parameter Estimates: 1.290796 0.3463698 0.4168197 -1.036225 Optimization Step: 39 Objective Function Value: -784.5939 Parameter Estimates: 1.290797 0.3463698 0.4168197 -1.036225 Optimization Step: 40 Objective Function Value: -784.5939 Parameter Estimates: 1.290796 0.3463708 0.4168197 -1.036225 Optimization Step: 41 Objective Function Value: -784.5939 Parameter Estimates: 1.290796 0.3463698 0.4168207 -1.036225 Optimization Step: 42 Objective Function Value: -784.5939 Parameter Estimates: 1.290796 0.3463698 0.4168197 -1.036223 Optimization Step: 43 Objective Function Value: -784.2295 Parameter Estimates: 1.273596 0.3590751 0.4047472 -1.037516 Optimization Step: 44 Objective Function Value: -784.2295 Parameter Estimates: 1.273597 0.3590751 0.4047472 -1.037516 Optimization Step: 45 Objective Function Value: -784.2295 Parameter Estimates: 1.273596 0.3590761 0.4047472 -1.037516 Optimization Step: 46 Objective Function Value: -784.2295 Parameter Estimates: 1.273596 0.3590751 0.4047482 -1.037516 Optimization Step: 47 Objective Function Value: -784.2295 Parameter Estimates: 1.273596 0.3590751 0.4047472 -1.037515 Optimization Step: 48 Objective Function Value: -783.9524 Parameter Estimates: 1.233687 0.3743468 0.3902842 -1.039026 Optimization Step: 49 Objective Function Value: -783.9524 Parameter Estimates: 1.233688 0.3743468 0.3902842 -1.039026 Optimization Step: 50 Objective Function Value: -783.9524 Parameter Estimates: 1.233687 0.3743478 0.3902842 -1.039026 Optimization Step: 51 Objective Function Value: -783.9524 Parameter Estimates: 1.233687 0.3743468 0.3902852 -1.039026 Optimization Step: 52 Objective Function Value: -783.9524 Parameter Estimates: 1.233687 0.3743468 0.3902842 -1.039025 Optimization Step: 53 Objective Function Value: -783.7974 Parameter Estimates: 1.199691 0.3735054 0.3851506 -1.038305 Optimization Step: 54 Objective Function Value: -783.7974 Parameter Estimates: 1.199692 0.3735054 0.3851506 -1.038305 Optimization Step: 55 Objective Function Value: -783.7974 Parameter Estimates: 1.199691 0.3735064 0.3851506 -1.038305 Optimization Step: 56 Objective Function Value: -783.7974 Parameter Estimates: 1.199691 0.3735054 0.3851516 -1.038305 Optimization Step: 57 Objective Function Value: -783.7974 Parameter Estimates: 1.199691 0.3735054 0.3851506 -1.038304 Optimization Step: 58 Objective Function Value: -783.5541 Parameter Estimates: 1.121298 0.35033 0.3781884 -1.033770 Optimization Step: 59 Objective Function Value: -783.5541 Parameter Estimates: 1.121299 0.35033 0.3781884 -1.033770 Optimization Step: 60 Objective Function Value: -783.5541 Parameter Estimates: 1.121298 0.350331 0.3781884 -1.033770 Optimization Step: 61 Objective Function Value: -783.5541 Parameter Estimates: 1.121298 0.35033 0.3781894 -1.033770 Optimization Step: 62 Objective Function Value: -783.5541 Parameter Estimates: 1.121298 0.35033 0.3781884 -1.033769 Optimization Step: 63 Objective Function Value: -783.4892 Parameter Estimates: 1.095006 0.3280334 0.3773114 -1.030188 Optimization Step: 64 Objective Function Value: -783.4892 Parameter Estimates: 1.095007 0.3280334 0.3773114 -1.030188 Optimization Step: 65 Objective Function Value: -783.4892 Parameter Estimates: 1.095006 0.3280344 0.3773114 -1.030188 Optimization Step: 66 Objective Function Value: -783.4892 Parameter Estimates: 1.095006 0.3280334 0.3773124 -1.030188 Optimization Step: 67 Objective Function Value: -783.4892 Parameter Estimates: 1.095006 0.3280334 0.3773114 -1.030187 Optimization Step: 68 Objective Function Value: -783.4774 Parameter Estimates: 1.092090 0.3172444 0.3775510 -1.028658 Optimization Step: 69 Objective Function Value: -783.4774 Parameter Estimates: 1.092091 0.3172444 0.3775510 -1.028658 Optimization Step: 70 Objective Function Value: -783.4774 Parameter Estimates: 1.092090 0.3172454 0.3775510 -1.028658 Optimization Step: 71 Objective Function Value: -783.4774 Parameter Estimates: 1.092090 0.3172444 0.3775520 -1.028658 Optimization Step: 72 Objective Function Value: -783.4774 Parameter Estimates: 1.092090 0.3172444 0.3775510 -1.028657 Optimization Step: 73 Objective Function Value: -783.4772 Parameter Estimates: 1.093737 0.3169665 0.3775734 -1.028645 Optimization Step: 74 Objective Function Value: -783.4772 Parameter Estimates: 1.093738 0.3169665 0.3775734 -1.028645 Optimization Step: 75 Objective Function Value: -783.4772 Parameter Estimates: 1.093737 0.3169675 0.3775734 -1.028645 Optimization Step: 76 Objective Function Value: -783.4772 Parameter Estimates: 1.093737 0.3169665 0.3775744 -1.028645 Optimization Step: 77 Objective Function Value: -783.4772 Parameter Estimates: 1.093737 0.3169665 0.3775734 -1.028644 Optimization Step: 78 Objective Function Value: -783.4772 Parameter Estimates: 1.093887 0.3169957 0.3775555 -1.028653 Optimization Step: 79 Objective Function Value: -783.4772 Parameter Estimates: 1.093888 0.3169957 0.3775555 -1.028653 Optimization Step: 80 Objective Function Value: -783.4772 Parameter Estimates: 1.093887 0.3169967 0.3775555 -1.028653 Optimization Step: 81 Objective Function Value: -783.4772 Parameter Estimates: 1.093887 0.3169957 0.3775565 -1.028653 Optimization Step: 82 Objective Function Value: -783.4772 Parameter Estimates: 1.093887 0.3169957 0.3775555 -1.028652 Optimization Step: 83 Objective Function Value: -783.4772 Parameter Estimates: 1.093885 0.3169972 0.3775544 -1.028653 Optimization Step: 84 Objective Function Value: -783.4772 Parameter Estimates: 1.093886 0.3169964 0.377555 -1.028653 Optimization Step: 85 Objective Function Value: -783.4772 Parameter Estimates: 1.093887 0.3169964 0.377555 -1.028653 Optimization Step: 86 Objective Function Value: -783.4772 Parameter Estimates: 1.093886 0.3169974 0.377555 -1.028653 Optimization Step: 87 Objective Function Value: -783.4772 Parameter Estimates: 1.093886 0.3169964 0.377556 -1.028653 Optimization Step: 88 Objective Function Value: -783.4772 Parameter Estimates: 1.093886 0.3169964 0.377555 -1.028652 [1] -3.510225 attr(,"param") alpha beta delta mu lambda 1.0938863 0.3169964 0.3775550 -1.0286526 -0.5000000 [1] 3.179961 attr(,"param") alpha beta delta mu lambda 1.0938863 0.3169964 0.3775550 -1.0286526 -0.5000000 Title: Normal Inverse Gaussian Parameter Estimation Call: nigFit(x = s, alpha = 1, beta = 0, delta = 1, mu = mean(s), doplot = TRUE) Model: Normal Inverse Gaussian Distribution Estimated Parameter(s): [1] 1.0938863 0.3169964 0.3775550 -1.0286526 Description: Wed Jul 13 14:04:23 2005 > > ## ssdFit - > xmpBasics("\nNext: Smoothed Spline Density > ") > set.seed(1953) > x = rnorm(1000) > ssdFit(x) Call: ssdFit(x = x) Smoothing parameters are selected by CV with alpha=1.4. > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "C1-TestsClass" > > ### * C1-TestsClass > > flush(stderr()); flush(stdout()) > > ### Name: TestsClass > ### Title: Tests Class Representation > ### Aliases: TestsClass fHTEST fHTEST-class show.fHTEST show,fHTEST-method > ### Keywords: htest > > ### ** Examples > > ## SOURCE("fBasics.C1-TestsClass") > > ## fHTEST - > getClass("fHTEST") Slots: Name: call data test title description Class: call list list character character > > > > cleanEx(); ..nameEx <- "C2-OneSampleTests" > > ### * C2-OneSampleTests > > flush(stderr()); flush(stdout()) > > ### Name: OneSampleTests > ### Title: One Sample Tests > ### Aliases: OneSampleTests normalTest ksnormTest shapiroTest > ### jarqueberaTest dagoTest adTest cvmTest lillieTest pchiTest sfTest > ### runsTest gofnorm > ### Keywords: htest > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.C1-TestsClass") > ## SOURCE("fBasics.C2-OneSampleTests") > > ## Series: > xmpBasics("\nStart: Create Series > ") > x = rnorm(100) > > ## ksnormTests - > xmpBasics("\nNext: Kolmogorov - Smirnov One-Sampel Test > ") > ksnormTest(x) Title: One-sample Kolmogorov-Smirnov test Test Results: STATISTIC: D: 0.0947 P VALUE: Alternative Two-Sided: 0.3317 Alternative Less: 0.1666 Alternative Greater: 0.8637 Description: Wed Jul 13 14:04:26 2005 > > ## shapiroTest - > xmpBasics("\nNext: Shapiro - Wilk Test > ") > shapiroTest(x) Title: Shapiro - Wilk Normality Test Test Results: STATISTIC: W: 0.9956 P VALUE: 0.9876 Description: Wed Jul 13 14:04:26 2005 > > ## jarqueberaTest - > xmpBasics("\nNext: Jarque - Bera Test > ") > jarqueberaTest(x) Title: Jarque - Bera Normalality Test Test Results: STATISTIC: X-squared: 0.0872 P VALUE: Asymptotic p Value: 0.9573 Description: Wed Jul 13 14:04:26 2005 > > ## dagoTest - > xmpBasics("\nNext: D'Agostino Test > ") > dagoTest(x) Title: D'Agostino Normality Test Test Results: STATISTIC: Chi2 | Omnibus: 0.2126 Z3 | Skewness: -0.3135 Z4 | Kurtosis: 0.338 P VALUE: Omnibus Test: 0.8992 Skewness Test: 0.7539 Kurtosis Test: 0.7353 Description: Wed Jul 13 14:04:26 2005 > > ## adTest - > xmpBasics("\nNext: Anderson - Darling Test > ") > adTest(x) > > ## cvmTest - > xmpBasics("\nNext: Cramer - von Mises Test > ") > cvmTest(x) Title: Cramer - von Mises Normality Test Test Results: STATISTIC: W: 0.026 P VALUE: 0.8945 Description: Wed Jul 13 14:04:26 2005 > > ## lillieTest - > xmpBasics("\nNext: Lillifors (KS) Test > ") > lillieTest(x) Title: Lilliefors (KS) Normality Test Test Results: STATISTIC: D: 0.047 P VALUE: 0.848 Description: Wed Jul 13 14:04:26 2005 > > ## pchiTest - > xmpBasics("\nNext: Pearson Chi-Squared Test > ") > pchiTest(x) Title: Pearson Chi-Square Normality Test Test Results: PARAMETER: Number of Classes: 13 STATISTIC: P: 8.16 P VALUE: Adhusted: 0.6132 Not adjusted: 0.7725 Description: Wed Jul 13 14:04:26 2005 > > ## sfTest - > xmpBasics("\nNext: Shapiro - Franca Test > ") > sfTest(x) Title: Shapiro - Francia Normality Test Test Results: STATISTIC: W: 0.9958 P VALUE: 0.9719 Description: Wed Jul 13 14:04:26 2005 > > ## gofnorm - > xmpBasics("\nNext: Goodness-of-Fit Test for Normality > ") > gofnorm(x, doprint = TRUE) Omnibus Moments Test -0.0722319 3.007653 Geary Test 0.797989 0.004190498 Studentized Range Test 5.139525 D'Agostino D-Statistic Test -0.3664088 Kuiper V-Statistic, Modified 0.8488133 Watson U^2-Statistic, Modified 0.02556628 Durbin Exact Test 0.02446274 Anderson-Darling Statistic 0.1614443 Cramer-Von Mises W^2-Statistic 0.02616146 Kolmogorov-Smirnov D-Statistic 0.4736642 KS, Lilliefors Critical Values 0.04701381 Chi-Square, Equal Prob. Classes 93.2 17 Shapiro-Francia W-Test 0.9958174 > > ## runsTest - > xmpBasics("\nNext: Runs Test > ") > runsTest(x) Runs Test data: x Standard Normal = 0.874, p-value = 0.3821 alternative hypothesis: two.sided > > > > cleanEx(); ..nameEx <- "C3-TwoSampleTests" > > ### * C3-TwoSampleTests > > flush(stderr()); flush(stdout()) > > ### Name: TwoSampleTests > ### Title: Two Sample Tests > ### Aliases: TwoSampleTests ks2Test tTest kw2Test varfTest bartlett2Test > ### fligner2Test ansariTest moodTest pearsonTest kendallTest spearmanTest > ### dansariw pansariw qansariw > ### Keywords: htest > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.C1-TestsClass") > ## SOURCE("fBasics.C2-OneSampleTests") > ## SOURCE("fBasics.C3-TwoSampleTests") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## x, y - > xmpBasics("\nStart: Create two Samples > ") > x = rnorm(50) > y = rnorm(50) > > ## ks2Test - > xmpBasics("\nNext: Distributional Tests > ") > ks2Test(x, y) Title: Kolmogorov-Smirnov Two Sample Test Test Results: STATISTIC: D | Two Sided: 0.12 D^- | Less: 0.12 D^+ | Greater: 0.12 P VALUE: Alternative Two-Sided: 0.8693 Alternative Exact Two-Sided: 0.8693 Alternative Less: 0.4868 Alternative Greater: 0.4868 Description: Wed Jul 13 14:04:26 2005 > > ## tTest | kw2Test - > xmpBasics("\nNext: Location Tests > ") > tTest(x, y) Title: t Test Test Results: PARAMETER: x Observations: 50 y Observations: 50 mu: 0 SAMPLE ESTIMATES: Mean of x: 0.1004 Mean of y: 0.1173 Var of x: 0.6912 Var of y: 0.9386 STATISTIC: T: -0.0935 T | Equal Var: -0.0935 P VALUE: Alternative Two-Sided: 0.9257 Alternative Less: 0.4629 Alternative Greater: 0.5371 Alternative Two-Sided | Equal Var: 0.9257 Alternative Less | Equal Var: 0.4629 Alternative Greater | Equal Var: 0.5371 CONFIDENCE INTERVAL: Two-Sided: -0.3753, 0.3415 Less: -Inf, 0.283 Greater: -0.3168, Inf Two-Sided | Equal Var: -0.3752, 0.3414 Less | Equal Var: -Inf, 0.2829 Greater | Equal Var: -0.3167, Inf Description: Wed Jul 13 14:04:26 2005 > kw2Test(x, y) Title: Kruskal-Wallis Two Sample Test Test Results: PARAMETER: x Observations: 50 y Observations: 50 SAMPLE ESTIMATES: Mean of x: 0.1004 Mean of y: 0.1173 Var of x: 0.6912 Var of y: 0.9386 STATISTIC: KW chi-squared: 0.1006 P VALUE: 0.7512 Description: Wed Jul 13 14:04:26 2005 > > ## varfTest, bartlett2Test | fligner2Test - > xmpBasics("\nNext: Variance Tests > ") > varfTest(x, y) Title: F Test of Variances Test Results: PARAMETER: Hypothesized Ratio: 1 Numerator df: 49 Denumerator df: 49 SAMPLE ESTIMATES: Ratio of Variances: 0.7364 STATISTIC: F: 0.7364 P VALUE: Alternative Two-Sided: 0.2876 Alternative Less: 0.1438 Alternative Greater: 0.8562 CONFIDENCE INTERVAL: Two-Sided: 0.4179, 1.2977 Less: 0, 1.1836 Greater: 0.4582, Inf Description: Wed Jul 13 14:04:26 2005 > bartlett2Test(x, y) Title: Bartlett Test for Homogeneity of Variances Test Results: STATISTIC: Bartlett's Chi-squared: 1.1308 P VALUE: 0.2876 Description: Wed Jul 13 14:04:26 2005 > fligner2Test(x, y) Title: Fligner-Killeen Test for Homogeneity of Variances Test Results: STATISTIC: FK:med chi-squared: 0.7943 P VALUE: 0.3728 Description: Wed Jul 13 14:04:26 2005 > > ## ansariTest | moodTest - > xmpBasics("\nNext: Scale Tests > ") > ansariTest(x, y) Title: Ansari-Bradley Test for Scale Test Results: STATISTIC: AB: 1318 P VALUE: Alternative Two-Sided : 0.5532 Alternative Two-Sided | Exact: 0.5594 Alternative Less : 0.2766 Alternative Less | Exact: 0.2797 Alternative Greater : 0.7234 Alternative Greater | Exact: 0.7249 CONFIDENCE INTERVAL: Two-Sided | Asymptotic : 0.5949, 1.2584 Two-Sided | Exact : 0.5948, 1.2584 Less | Asymptotic : 0, 1.201 Less | Exact : 0, 1.201 Greater | Asymptotic : 0.64, Inf Greater | Exact : 0.6399, Inf Description: Wed Jul 13 14:04:28 2005 > moodTest(x, y) Title: Mood Two-Sample Test of Scale Test Results: STATISTIC: Z: -0.94 P VALUE: Alternative Two-Sided: 0.3472 Alternative Less: 0.1736 Alternative Greater: 0.8264 Description: Wed Jul 13 14:04:28 2005 > > ## pearsonTest | kendallTest | spearmanTest - > xmpBasics("\nNext: Correlation Tests > ") > pearsonTest(x, y) Title: Pearson's Correlation Test Test Results: PARAMETER: Degrees of Freedom: 48 SAMPLE ESTIMATES: Correlation: -0.0391 STATISTIC: t: -0.271 P VALUE: Alternative Two-Sided: 0.7875 Alternative Less: 0.3938 Alternative Greater: 0.6062 CONFIDENCE INTERVAL: Two-Sided: -0.314, 0.2419 Less: -1, 0.1982 Greater: -0.272, 1 Description: Wed Jul 13 14:04:28 2005 > kendallTest(x, y) Title: Kendall's tau Correlation Test Test Results: SAMPLE ESTIMATES: tau: -0.0955 STATISTIC: z: -0.9787 T | Exact: 554 P VALUE: Alternative Two-Sided: 0.3277 Alternative Two-Sided | Exact: 0.3337 Alternative Less: 0.1639 Alternative Less | Exact: 0.1668 Alternative Greater: 0.8361 Alternative Greater | Exact: 0.8373 Description: Wed Jul 13 14:04:28 2005 > spearmanTest(x, y) Title: Spearman's rho Correlation Test Test Results: SAMPLE ESTIMATES: rho: -0.1352 STATISTIC: S: 23640 P VALUE: Alternative Two-Sided: 0.3482 Alternative Less: 0.1741 Alternative Greater: 0.826 Description: Wed Jul 13 14:04:28 2005 > > > > cleanEx(); ..nameEx <- "D1-StylizedFacts" > > ### * D1-StylizedFacts > > flush(stderr()); flush(stdout()) > > ### Name: StylizedFacts > ### Title: Stylized Facts > ### Aliases: StylizedFacts acfPlot pacfPlot ccfPlot teffectPlot lmacfPlot > ### logpdfPlot qqgaussPlot scalinglawPlot > ### Keywords: hplot > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.A3-BasicPlots") > ## SOURCE("fBasics.D1-StylizedFacts") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## logpdfPlot - > xmpBasics("\nStart: log PDF Plot > ") > # Plot the log-returns of the NYSE Composite Index > # and compare with the Gaussian Distribution: > par(mfrow = c(2, 2)) > data(nyseres) > # Extract from data.frame: > x = nyseres[, 1] > logpdfPlot(x, main = "log PDF Plot") Warning in hist.default(x, nclass = cells, include.lowest = include.lowest, : 'include.lowest' ignored as 'breaks' is not a vector > # loglogpdfPlot - > # Plot the log-returns of the NYSE Composite Index > # and compare with the Gaussian Distribution: > logpdfPlot(x, type = "log-log", main = "log-log PDF Plot") Warning in hist.default(x, nclass = cells, include.lowest = include.lowest, : 'include.lowest' ignored as 'breaks' is not a vector > > ## qqgaussPlot - > xmpBasics("\nNext: QQ Normal Plot > ") > # Create a Gaussian Quantile-Quantile plot > # for the NYSE Composite Index log-returns: > qqgaussPlot(x) > > ## scalinglawPlot - > xmpBasics("\nNext: Scaling Law Plot > ") > # Investigate and Plot the Scaling Law > # for the NYSE Composite Index log-returns: > scalinglawPlot(x) > > ## acfPlot - > xmpBasics("\nNext: Auto-Correlation Function Plot > ") > data(EuStockMarkets) > par(mfrow = c(2, 1)) > returns.ftse = diff(log(EuStockMarkets[,"FTSE"])) > returns.dax = diff(log(EuStockMarkets[,"DAX"])) > acfPlot(x = returns.ftse, main = "FTSE Autocorrelation") > > ## ccfPlot - > xmpBasics("\nNext: Cross-Correlation Function Plot > ") > ccfPlot(x = returns.ftse, y = returns.dax, + main="FTSE - DAX Crosscorrelation") > > ## lmacfPlot - > xmpBasics("\nNext: Long-Memory ACF Plot > ") > # Estimate and plot the Long Memory ACF of the DAX volatilities > # and evaluate the Hurst exponent of a time series: > par(mfrow = c(2, 1)) > lmacfPlot(abs(returns.dax), main = "DAX") Long Memory Autocorrelation Function: Maximum Lag 32 Cut-Off ConfLevel 0.0454578 Plot-Intercept -1.841557 Plot-Slope -0.2029626 Hurst Exponent 0.8985187 > > ## teffectPlot - > xmpBasics("\nNext: Taylor Effect Plot > ") > # Estimate and plot the Taylor Effect for the > # log returns of the NYSE Compositie Index. > teffectPlot(returns.dax) > teffectPlot(returns.ftse) > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "X1-BasicsData" > > ### * X1-BasicsData > > flush(stderr()); flush(stdout()) > > ### Name: BasicsData > ### Title: fBasics Data Sets > ### Aliases: BasicsData audusd bmwres fdax9710 fdax97m nyse nyseres usdthb > ### Keywords: datasets > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## plot - > xmpBasics("\nStart: Plot Residuals NYSE Composite Index > ") > data(nyseres) > x = as.ts(nyseres) > par(mfrow = c(2, 1), cex = 0.75) > plot(100*x, type = "l", col = "steelblue4", + main = "NYSE Composite Index") > grid() > plot(cumsum(x), type = "l", col = "steelblue4", + main = "Cumulated NYSE Index") > grid() > > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "X2-MofitsData" > > ### * X2-MofitsData > > flush(stderr()); flush(stdout()) > > ### Name: MofitsData > ### Title: fBasics Data Sets from MoFiTS > ### Aliases: MofitsData CPI.dat DowJones30 highFreq3M.df IP.dat > ### lexrates.dat msft.dat shiller.annual shiller.dat singleIndex.dat > ### varex.ts yhoo.df > ### Keywords: datasets > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## Not run: > ##D ## DowJones30 - > ##D xmpBasics("\nStart: Dow Jones Industrial Average > ") > ##D data(DowJones30) > ##D class(DowJones30) > ##D DowJones30.ts = as.timeSeries(DowJones30) > ##D class(DowJones30.ts) > ##D head(DowJones30.ts) > ## End(Not run) > > > > cleanEx(); ..nameEx <- "Z1-BasicsTools" > > ### * Z1-BasicsTools > > flush(stderr()); flush(stdout()) > > ### Name: fBasicsTools > ### Title: fBasics Tools > ### Aliases: fBasicsTools xmpBasics xmpfBasics unirootNA > ### Keywords: programming > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.Z1-BasicsTools") > > > > cleanEx(); ..nameEx <- "Z2-FunctionAddon" > > ### * Z2-FunctionAddon > > flush(stderr()); flush(stdout()) > > ### Name: FunctionAddon > ### Title: Demo Function Addon > ### Aliases: FunctionAddon > ### Keywords: programming > > ### ** Examples > > ## SOURCE("fBasics.A0-SPlusCompatibility") > ## SOURCE("fBasics.Z1-BasicsTools") > > ## funBasics - > # The examples can be found in > # the demo file "funBasics". > > > > ### *