fBasics-package {fBasics} | R Documentation |
The Rmetrics "fBasics" package is a collection of functions to explore and to investigate basic properties of financial returns and related quantities.
The covered fields include techniques of explorative data analysis and the investigation of distributional properties, including parameter estimation and hypothesis testing. Evenmore there are several utility functions for data handling and managemnet.
Package: | fBasics |
Type: | Package |
Version: | 270.73 |
Date: | 2009 |
License: | GPL Version 2 or later |
Copyright: | (c) 1999-2010 Rmetrics Assiciation |
URL: | http://www.rmetrics.org |
1. Basic Statistics Functions
2. Financial Return Distributions
3. Hypothesis Testing
4. Plotting Routines
5. Matrix Computations and Linear Algebra
6. Utility Functions for Data Management
7. Other Utility Functions
Financial Return Statistics:
Function ________________ | Description _________________________________________ |
basicStats | Returns a basic statistics summary. |
File: stats-basicStats.R | |
Function ________________ | Description _________________________________________ |
dmaxdd | Density function of mean Max-Drawdowns |
pmaxdd | Probability function of mean Max-Drawdowns |
rmaxdd | Random Variates of mean Max-Drawdowns |
maxddStats | Expectation of Drawdowns for BM with drift. |
File: stats-maxdd.R |
Calculation of Sample Moments:
Function ________________ | Description _________________________________________ |
sampleLmoments | Computes sample L-moments. |
File: stats-sampleLMoments.R | |
Function ________________ | Description _________________________________________ |
sampleMED | Returns sample median |
sampleIQR | returns sample inter quartal range |
sampleSKEW | returns robust sample skewness |
sampleKURT | returns robust sample kurtosis. |
File: stats-sampleRobMoments.R |
Bivariate Interpolation:
Function ________________ | Description _________________________________________ |
akimaInterp | Interpolates irregularly spaced points |
akimaInterpp | Interpolates and smoothes pointwise. |
File: stats-interpAkima.R | |
Function ________________ | Description _________________________________________ |
krigeInterp | Kriges irregularly spaced data points. |
File: stats-interpKrige.R | |
Function ________________ | Description _________________________________________ |
linearInterp | Interpolates irregularly spaced points |
linearInterpp | Interpolates linearly pointwise. |
File: stats-interpLinear.R |
Utility Functions:
Function ________________ | Description _________________________________________ |
colStats | Computes sample statistics by col |
colSums | Computes sums of values in each col |
colMeans | Computes means of values in each col |
colSds | Computes standard deviation of each col |
colVars | Computes sample variance by col |
colSkewness | Computes sample skewness by col |
colKurtosis | Computes sample kurtosis by col |
colMaxs | Computes maximum values in each col |
colMins | Computes minimum values in each col |
colProds | Computes product of values in each col |
colQuantiles | Computes product of values in each col. |
File: has been moved tp package timeSeries | |
Function ________________ | Description _________________________________________ |
rowStats | Computes sample statistics by row |
rowSums | Computes sums of values in each row |
rowMeans | Computes means of values in each row |
rowSds | Computes standard deviation of each row |
rowVars | Computes sample variance by row |
rowSkewness | Computes sample skewness by row |
rowKurtosis | Computes sample kurtosis by row |
rowMaxs | Computes maximum values in each row |
rowMins | Computes minimum values in each row |
rowProds | Computes product of values in each row |
rowQuantiles | Computes product of values in each row. |
File: stats-rowStats.R |
Generalized Hyperbolic Distribution:
Function ________________ | Description _________________________________________ |
dgh | Returns density for the GH distribution |
pgh | returns probability for the GH distribution |
qgh | returns quantiles for the GH distribution |
rgh | returns random variates for the GH distribution. |
File: dist-gh.R | |
Function ________________ | Description _________________________________________ |
ghFit | Fits parameters of the GH distribution. |
File: dist-ghFit.R | |
Function: ________________ | Description _________________________________________ |
ghMode | Computes mode of the GH distribution. |
File: dist-ghMode.R | |
Function ________________ | Description _________________________________________ |
ghMean | Returns true mean of the GH distribution |
ghVar | returns true variance of the GH distribution |
ghSkew | returns true skewness of the GH distribution |
ghKurt | returns true kurtosis of the GH distribution |
ghMoments | returns true n-th moment of the GH distribution. |
File: dist-ghMoments.R | |
Function ________________ | Description _________________________________________ |
ghMED | Returns true median of te GH distribution |
ghIQR | returns true inter quartal range of te GH |
ghSKEW | returns true robust skewness of te GH |
ghKURT | returns true robust kurtosis of te GH. |
File: dist-ghRobMoments.R |
Hyperbolic Distribution:
Function ________________ | Description _________________________________________ |
dhyp | Returns density for the HYP distribution |
phyp | returns probability for the HYP distribution |
qhyp | returns quantiles for the HYP distribution |
rhyp | returns random variates for the HYP distribution. |
File: dist-hyp.R | |
Function ________________ | Description _________________________________________ |
hypFit | Fits parameters of the HYP distribution. |
File: dist-hypFit.R | |
Function ________________ | Description _________________________________________ |
hypMode | Computes mode of the HYP distribution. |
File: dist-hypMode.R | |
Function ________________ | Description _________________________________________ |
hypMean | Returns true mean of the HYP distribution |
hypVar | returns true variance of the HYP distribution |
hypSkew | returns true skewness of the HYP distribution |
hypKurt | returns true kurtosis of the HYP distribution |
hypMoments | returns true n-th moment of the HYP distribution. |
File: dist-hypMoments.R | |
Function ________________ | Description _________________________________________ |
hypMED | Returns true median of the HYP distribution |
hypIQR | returns true inter quartal range of the HYP |
hypSKEW | returns true robust skewness of the HYP |
hypKURT | returns true robust kurtosis of the HYP. |
File: dist-hypRobMoments.R |
Normal Inverse Gaussian:
Function ________________ | Description _________________________________________ |
dnig | Returns density for the NIG distribution |
pnig | returns probability for the NIG distribution |
qnig | returns quantiles for the NIG distribution |
rnig | returns random variates for the NIG distribution |
.pnigC | fast C implementation of function pnig() |
.qnigC | fast C implementation of function qnig(). |
File: dist-nig.R | |
Function ________________ | Description _________________________________________ |
nigFit | Fits parameters of a NIG distribution |
.nigFit.mle | uses max Log-likelihood estimation |
.nigFit.gmm | uses generalized method of moments |
.nigFit.mps | maximum product spacings estimation |
.nigFit.vmps | minimum variance mps estimation. |
File: dist-nigFit.R | |
Function ________________ | Description _________________________________________ |
nigMode | Computes mode of the NIG distribution. |
File: dist-nigMode.R | |
Function ________________ | Description _________________________________________ |
nigMean | Returns true mean of the NIG distribution |
nigVar | returns true variance of the NIG distribution |
nigSkew | returns true skewness of the NIG distribution |
nigKurt | returns true kurtosis of the NIG distribution |
nigMoments | returns true n-th moment of the NIG distribution. |
File: dist-nigMoments.R | |
Function ________________ | Description _________________________________________ |
nigMED | Returns true median of the NIG distribution |
nigIQR | returns true inter quartal range of the NIG |
nigSKEW | returns true robust skewness of the NIG |
nigKURT | returns true robust kurtosis of the NIG. |
File: dist-nigRobMoments.R |
Generalized Hyperbolic Student-t Distribution:
Function ________________ | Description _________________________________________ |
dght | Returns density for the GHT distribution |
pght | returns probability for the GHT distribution |
qght | returns quantiles for the GHT distribution |
rght | returns random variates for the GHT distribution. |
File: dist-ght.R | |
Function ________________ | Description _________________________________________ |
ghtFit | Fits parameters of the GHT distribution. |
File: dist-ghtFit.R | |
Function ________________ | Description _________________________________________ |
ghtMode | Computes mode of the GHT distribution. |
File: dist-ghtMode.R | |
Function ________________ | Description _________________________________________ |
ghtMean | Returns true mean of the NIG distribution |
ghtVar | returns true variance of the GHT distribution |
ghtSkew | returns true skewness of the GHT distribution |
ghtKurt | returns true kurtosis of the GHT distribution |
ghtMoments | returns true n-th moment of the GHT distribution. |
File: dist-ghtMoments.R | |
Function ________________ | Description _________________________________________ |
ghtMED | Returns true median of the GHT distribution |
ghtIQR | returns true inter quartal range of the GHT |
ghtSKEW | returns true robust skewness of the GHT |
ghtKURT | returns true robust kurtosis of the GHT. |
File: dist-ghtRobMoments.R |
Stable Distribution:
Function ________________ | Description _________________________________________ |
dstable | Returns density for the stable distribution |
pstable | returns probability for the stable distribution |
qstable | returns quantiles for the stable distribution |
rstable | returns random variates for the dtsble distribution. |
File: dist-stable.R | |
Function ________________ | Description _________________________________________ |
stableFit | Fits parameters of a the stable distribution |
.phiStable | Creates contour table for McCulloch estimators |
.PhiStable | Contour table created by function .phiStable() |
.qStableFit | Estimates parameters by McCulloch's approach |
.mleStableFit | Estimates stable parameters by MLE approach |
.stablePlot | Plots results of stable parameter estimates. |
File: dist-stableFit.R | |
Function ________________ | Description _________________________________________ |
stableMode | Computes mode of the stable distribution. |
File: dist-stableMode.R |
Generalized Lambda Distribution:
Function ________________ | Description _________________________________________ |
dgld | Returns density for the GLD distribution |
pgld | returns probability for the GLD distribution |
qgld | returns quantiles for the GLD distribution |
rgld | returns random variates for the GLD distribution. |
File: dist-gld.R | |
Function ________________ | Description _________________________________________ |
gldFit | Fits parameters of the GLD distribution |
.gldFit.mle | fits GLD using maximum log-likelihood |
.gldFit.mps | fits GLD using maximum product spacings |
.gldFit.gof | fits GLD using Goodness of Fit statistics |
.gldFit.hist | fits GLD using a histogram fit |
.gldFit.rob | fits GLD using robust moments fit. |
File: dist-gldFit.R | |
Function ________________ | Description _________________________________________ |
gldMode | Computes mode of the GLD distribution. |
File: dist-gldMode.R | |
Function ________________ | Description _________________________________________ |
gldMED | Returns true median of the GLD distribution |
gldIQR | returns true inter quartal range of the GLD |
gldSKEW | returns true robust skewness of the GLD |
gldKURT | returns true robust kurtosis of the GLD. |
File: dist-gldRobMoments.R |
Spline Smoothed Distribution:
Function ________________ | Description _________________________________________ |
dssd | Returns spline smoothed density function |
pssd | returns spline smoothed probability function |
qssd | returns spline smoothed quantile function |
rssd | returns spline smoothed random variates. |
File: dist-ssd.R | |
Function ________________ | Description _________________________________________ |
ssdFit | Fits parameters for a spline smoothed distribution. |
File: dist-ssdFit.R |
One Sample Tests:
Function ________________ | Description _________________________________________ |
ksnormTest | One sample Kolmogorov-Smirnov normality test |
shapiroTest | Shapiro-Wilk normality test |
jarqueberaTest | Jarque-Bera normality test |
normalTest | Normality tests S-Plus compatible call |
dagoTest | D'Agostino normality test |
adTest | Anderson-Darling normality test |
cvmTest | Cramer-von Mises normality test |
lillieTest | Lilliefors (KS) normality test |
pchiTest | Pearson chi-square normality test |
sfTest | Shapiro-Francia normality test |
jbTest | Finite sample adjusted JB LM and ALM test |
File: test-normalTest.R | |
Function ________________ | Description _________________________________________ |
locationTest | Performs locations tests on two samples |
.tTest | Unpaired t test for differences in mean |
.kw2Test | Kruskal-Wallis test for differences in locations |
File: test-locationTest.R | |
Function ________________ | Description _________________________________________ |
scaleTest | Performs scale tests on two samples |
.ansariTest | Ansari-Bradley test for differences in scale |
.moodTest | Mood test for differences in scale |
File: test-scaleTest.R | |
Function ________________ | Description _________________________________________ |
varianceTest | Performs variance tests on two samples |
.varfTest | F test for differences in variances |
.bartlett2Test | Bartlett's test for differences in variances |
.fligner2Test | Fligner-Killeen test for differences in variances |
File: test-variance Test.R |
Two Sample Tests:
Function ________________ | Description _________________________________________ |
ks2Test | Performs a two sample Kolmogorov-Smirnov test |
correlationTest | Performs correlation tests on two samples |
pearsonTest | Pearson product moment correlation coefficient |
kendallTest | Kendall's tau correlation test |
spearmanTest | Spearman's rho correlation test |
File: test-ks2Test.R |
Test Utilities:
Function ________________ | Description _________________________________________ |
'fHTEST' | S4 Class Representation |
show.fHTEST | S4 Print Method |
.jbALM | Jarque Bera Augmented Lagrange Multiplier Data |
.jbLM | Jarque-Bera Lagrange Multiplier Data |
.jbTable | Finite sample p values for the Jarque Bera test |
.jbPlot | Plots probabilities |
.pjb | Returns probabilities for JB given quantiles |
.qjb | Returns quantiles for JB given probabilities |
File: test-fHTEST.R |
Financial Time Series Plots:
Function ________________ | Description _________________________________________ |
seriesPlot | Dispalys a time series plot |
cumulatedPlot | displays cumulated series give returns |
returnPlot | displays returns given cumulated series |
drawdownPlot | displays drawdown series from returns. |
File: plot-seriesPlot.R |
Correlation Plots:
Function ________________ | Description _________________________________________ |
acfPlot | Displays tailored ACF plot |
pacfPlot | displays tailored partial ACF plot |
teffectPlot | displays the Taylor effect |
lacfPlot | displays lagged autocorrelations. |
File: plot-acfPlot.R |
Distribution Plots:
Function ________________ | Description _________________________________________ |
histPlot | Returns tailored histogram plot |
densityPlot | returns tailored density plot |
logDensityPlot | returns tailored log density plot. |
File: plot-histPlot.R | |
Function ________________ | Description _________________________________________ |
boxPlot | Returns side-by-side standard box plot |
boxPercentilePlot | returns box-percentile plot. |
File: plot-boxPlot.R | |
Function ________________ | Description _________________________________________ |
qqnormPlot | Returns normal quantile-quantile plot |
qqnigPlot | returns NIG quantile-quantile plot |
qqghtPlot | returns GHT quantile-quantile plot |
qqgldPlot | returns GLD quantile-quantile plot. |
File: plot-qqPlot.R |
Aggregation Plots:
Function ________________ | Description _________________________________________ |
scalinglawPlot | displays scaling law behavior. |
File: plot-scalinglawPlot.R |
Matrix Operations:
Function ________________ | Description _________________________________________ |
kron | Returns the Kronecker product. |
File: matrix-kron.R | |
Function ________________ | Description _________________________________________ |
vec | Stacks a matrix as column vector |
vech | stacks a lower triangle matrix. |
File: matrix-vech.R | |
Function ________________ | Description _________________________________________ |
pdl | Returns regressor matrix for polynomial lags. |
File: matrix-pdl.R | |
Function ________________ | Description _________________________________________ |
tslag | Returns Lagged/leading vector/matrix. |
File: matrix-tslag.R |
Linear Algebra:
Function ________________ | Description _________________________________________ |
inv | Returns the inverse of a matrix. |
File: matrix-inv.R | |
Function ________________ | Description _________________________________________ |
norm | Returns the norm of a matrix. |
File: matrix-norm.R | |
Function ________________ | Description _________________________________________ |
rk | Returns the rank of a matrix. |
File: matrix-rk.R | |
Function ________________ | Description _________________________________________ |
tr | Returns the trace of a matrix. |
File: matrix-tr.R |
Matrix Utilities:
Function ________________ | Description _________________________________________ |
isPositiveDefinite | Checks if a matrix is positive definite |
makePositiveDefinite | forces a matrix to be positive definite. |
File: matrix-posDefinite.R | |
Function ________________ | Description _________________________________________ |
colVec | Creates a column vector from a data vector |
rowVec | creates a row vector from a data vector. |
File: matrix-colVec.R | |
Function ________________ | Description _________________________________________ |
gridVector | Creates from two vectors rectangular grid. |
File: matrix-gridVector.R | |
Function ________________ | Description _________________________________________ |
triang | Extracs lower tridiagonal part from a matrix |
Triang | Extracs upper tridiagonal part from a matrix. |
File: matrix-triang.R |
Matrix Examples:
Function ________________ | Description _________________________________________ |
hilbert | Creates a Hilbert matrix. |
File: matrix-hilbert.R | |
Function ________________ | Description _________________________________________ |
pascal | Creates a Pascal matrix. |
File: matrix-pascal.R |
Color Utilities:
Function ________________ | Description _________________________________________ |
colorLocator | Plots Rs 657 named colors for selection |
colorMatrix | returns matrix of R's color names. |
File: utils-colorLocator.R | |
Function ________________ | Description _________________________________________ |
colorTable | Table of Color Codes and Plot Colors itself. |
File: utils-colorTable.R | |
Function ________________ | Description _________________________________________ |
rainbowPalette | Contiguous rainbow color palette |
heatPalette | Contiguous heat color palette |
terrainPalette | Contiguous terrain color palette |
topoPalette | Contiguous topo color palette |
cmPalette | Contiguous cm color palette |
greyPalette | R's gamma-corrected gray palette |
timPalette | Tim's Matlab like color palette |
rampPalette | Color ramp palettes |
seqPalette | Sequential color brewer palettes |
divPalette | Diverging color brewer palettes |
qualiPalette | Qualified color brewer palettes |
focusPalette | Red, green blue focus palettes |
monoPalette | Red, green blue mono palettes. |
File: utils-colorPalette.R |
Plot Utilities:
Function ________________ | Description _________________________________________ |
symbolTable | Shows a table of plot symbols. |
File: utils-symbolTable.R | |
Function ________________ | Description _________________________________________ |
characterTable | Shows a table of character codes. |
File: utils-characterTable.R | |
Function ________________ | Description _________________________________________ |
decor | Adds horizontal grid and L shaped box |
hgrid | adds horizontal grid lines |
vgrid | adds vertical grid lines |
boxL | adds L-shaped box |
box_ | adds unterlined box |
.xrug | adds rugs on x axis |
.yrug | adds rugs on y axis |
copyright | adds copyright notice. |
File: utils-decor.R | |
Function ________________ | Description _________________________________________ |
interactivePlot | Plots several graphs interactively. |
File: utils-interactivePlot.R |
Special Function Utilities:
Function ________________ | Description _________________________________________ |
Heaviside | Computes Heaviside unit step function |
Sign | another signum function |
Delta | computes delta function |
Boxcar | computes boxcar function |
Ramp | computes ramp function. |
File: utils-heaviside.R | |
Function ________________ | Description _________________________________________ |
tsHessian | Computes Two Sided Hessian matrix. |
File: utils-hessian.R |
Other Utilities:
Function ________________ | Description _________________________________________ |
.unirootNA | Computes zero of a function without error exit. |
File: utils-unitrootNA.R | |
Function ________________ | Description _________________________________________ |
getModel | extracts the model slot from a S4 object |
getTitle | extracts the title slot from a S4 object |
getDescription | extracts the description slot |
getSlot | extracts a specified slot from a S4 object. |
File: utils-getS4.R |
1. Dependences and Suggested Packages
2. Builtin Functions
3. Compiled Fortran and C Code
Required packages include:
Dependences _________________ | Description _________________________________________ |
MASS | R base package |
methods | R base package |
timeDate | Rmetrics package |
timeSeries | Rmetrics package |
Suggested ___________________ | Description _________________________________________ |
akima | contributed R package |
spatial | contributed R package |
RUnit | contributed R package |
tcltk | contributed R package. |
Builtin functions are borrowed from contributed R packages and other sources. There are several reasons why we have modified and copied code from other sources and included in this package.
* The builtin code is not available on Debian, so that Linux users have no easy acces to this code.
* The code conflicts with other code from this package or conflicts with Rmetrics design objectives.
* We only need a very small piece of functionality from the original package which may depend on other packages which are not needed.
* The package from which we builtin the code is under current development, so that the functions often change and thus leads to unexpectect behavior in the Rmetrics packages
* The package may be incompatible since it uses other time date and time series classes than the timDate and timeSeries objects and methods from Rmetrics.
We put the code in script files named builtin-funPackage.R where "fun" denotes the (optional) major function name, and "Package" the name of the contributed package from which we copied the original code.
Builtin functions include:
Builtin _________________ | Description _________________________________________ |
gelGmm | gll function from gmm package |
gmmGMM | gmm function from gmm package |
kweightsSandwhich | kweights from sandwhich package |
glGld | glfunctions from gld package |
ssdenGss | ssden from the gss package |
hypHyperbolicDist | hyp from HyperbolicDist package. |
Fortran/C _________________ | Description _________________________________________ |
gld.c | source code from gld package |
nig.c | source code from Kersti Aas |
gss.f | source code fromsandwhich package. |
Copyright Rmetrics Association
www.rmetrics.org
Addresses: