fUtilities-package {fBasics}R Documentation

Utilities and Tools Package

Description

Package of basic utilities and general tools for Rmetrics.

Details

Package: fUtilities
Type: Package
Version: 261.73.1
Date: 2008
License: GPL Version 2 or later
Copyright: (c) 1999-2008 Diethelm Wuertz and Rmetrics Foundation
URL: http://www.rmetrics.org

Overview of Topics:

1. Basic Function Extensions
2. Column and Row Statistics for Rectangular Objects
3. Skewness and Kurtosis Statistics
4. Bivariate Interpolation and Kriging
5. Code Tables, Color Selection and Palettes
6. Vector/Matrix Arithmetics and Linear Algebra Addons
7. Special Functions Addon

1. Basic Function Extensions

Several functions are added by Rmetrics which are missing in R's basic packages.

The first set of these functions are concerned with R functions which were made generic, so that they could be used to add additional methods:

align adds align function,
as.POSIXlt adds POSIXlt function,
atoms adds atoms function,
attach extends attach function,
colnames<- adds colnames assignment,
cor extends cor function,
cov extends cov function,
log extends log function,
outlier adds outlier function,
rank extends rank function,
rownames<- adds rownames assigment,
sample extends sample function,
stdev adds stdev function,
termPlot adds term plot function,
var extends var function,
volatility adds volatility function.

All these functions have now default methods. Furthermore the fUtilities package also provides additional methods. These include:

as.matrix.ts adds as.matrix.ts method,
as.matrix.mts adds as.matrix.mts method,
print.control adds print.control method.

2. Statistical Function Extensions

Beside the basic function extensions also statistical function extensions are provided. This concerns the missing "skewness" and "kurtosis" functions in R

skewness returns value of skewness,
kurtosis returns value of kurtosis.

and functions for column and row statistics. The colStats and rowStats are quite general functions which allow to specify the function to compute the desired statistics by the user. The remaining column and row statistics functions are thought to compute often used time series statistics. This includes the sum(, mean, standard deviations, variance, skewness, kurtosis, maximum, minimum, product, and quantile value.

Column Statistics:

colStats calculates column statistics,
colSums calculates column sums,
colMeans calculates column means,
colSds calculates column standard deviations,
colVars calculates column variances,
colSkewness calculates column skewness,
colKurtosis calculates column kurtosis,
colMaxs calculates maximum values in each column,
colMins calculates minimum values in each column,
colProds computes product of all values in each column,
colQuantiles computes quantiles of each column.

Row Statistics:

rowStats calculates row statistics,
rowSums calculates row sums,
rowMeans calculates row means,
rowSds calculates row standard deviations,
rowVars calculates row variances,
rowSkewness calculates row skewness,
rowKurtosis calculates row kurtosis,
rowMaxs calculates maximum values in each row,
rowMins calculates minimum values in each row,
rowProds computes product of all values in each row,
rowQuantiles computes quantiles of each row.

For hypothesis testing Rmetrics offers a new S4 class and print method:

fHTEST Representation for an S4 object of class "fHTEST",
show S4 print method.

3. Graph and Plot Tools

Character, symbol and color tables are useful tools if one is concerned with graphs and charts:

characterTable Table of Numerical Equivalents to Latin Characters,
symbolTable Table of plot characters, plot symbols,
colorTable Table of Color Codes and Plot Colors itself,
colorLocator Plots R's 657 named colors for selection,
colorMatrix Returns matrix of R's color names.

Many wrapper functions to create color palettes are also added, all following the same naming conventions:

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.

An interactive plot function allows to create easily interactive plots:

interactivePlot a framework for interactive plot displays.

4. Bivariate Interpolation and Kriging

Functions which allow to interpolate and smooth bivariate irregular data sets including linear interpolation, Akima spline interpolation, and kriging:

linearInterp performs linear spline interpolation,
akimaInterp performs Akima spline interpolation,
krigeInterp performs krige interpolation.

4. Vector/Matrix Arithmetics and Linear Algebra Addons

Functions for matrix arithmetics and linear algebra. These functions are often very useful for the manipulation of the data slot of multivariate financial time series.

General Matrix Functions:

triang Extracs the lower tridiagonal part from a matrix,
Triang Extracs the upper tridiagonal part from a matrix,
pascal Creates a Pascal matrix,
hilbert Creates a Hilbert matrix,
colVec Creates a column vector from a vector,
rowVec Creates a row vector from a vector,
isPositiveDefinite Checks if a matrix is positive definite,
makePositiveDefinite Forces a matrix to be positive definite,
colIds Retrieves or sets the colnames of an object,
rowIds Retrieves or sets the rowumn names.

Linear algebra functions in R's base package include the %*% product of two matrices, the %x% Kronecker product, the det determinant of a matrix, and the t transposed matrix.

Rmetrics adds the foloowing functions:

inv Returns the inverse of a matrix,
norm Returns the norm of a matrix,
rk Returns the rank of a matrix,
tr Returns trace of a matrix,
vech Is the operator that stacks the lower triangle,
vec Is the operator that stacks a matrix.

Note, additional linear algebra functionality is provided in R through the functions chol which returns the Cholesky factor matrix, eigen which computes eigenvalues and eigenvectors, svd which does singular value decomposition, kappa which determines the condition number of a matrix, qr which performs the QR decomposition of a matrix, solve which solves a system of linear equations, together with the functions backsolve used when the matrix is upper triangular, and forwardsolve used when the matrix is lower triangular.

6. Time Series Generation

For the computation of lagged or leading series the following two functions are provided by Rmetrics:

tslag Lagged or leading vector/matrix of selected order(s),
pdl Regressor matrix for polynomial distributed lags.

7. Special Functions Addon

Functions which compute special functions missing in R's base package include:

Heaviside and Related Functions:

Heaviside Computes Heaviside unit step function,
Sign Just another signum function,
Delta Computes delta function,
Boxcar Computes boxcar function,
Ramp Computes ramp function.

Generator for Portable Random Innovations:

set.lcgseed Set initial random seed,
get.lcgseed Get the current valus of the random seed,
runif.lcg Uniform linear congruational generator,
rnorm.lcg Normal linear congruational generator,
rt.lcg Student-t linear congruential generator.

8. Some utility functions

Finally we like to mention some further utility functions:

gridVector creates from two vectors x and y all grid points.

Author(s)

The fUtilities package was originally written by Diethelm Wuertz and is maintained since 2007 and further developed by him and the Rmetrics core team.


[Package fBasics version 2100.78 Index]