Site icon R-bloggers

The BurStFin R package

[This article was first published on Portfolio Probe » R language, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Version 1.01 of BurStFin is now on CRAN.

It is written entirely in R, and meant to be compatible with S+.

Functionality

The package is aimed at quantitative finance, but the variance estimation functions could be of use in other applications as well.

Also of general interest is threeDarr which creates a three-dimensional array out of matrices.

Variance estimation

The most important functions in the package are:

Both of these functions can estimate variances when there are more variables (assets in finance) than observations.  Both of them also allow missing values in the input.

The tawny package has a function for Ledoit-Wolf shrinkage but it does not allow missing values.  Also in tawny is a function to estimate variance based on random matrix theory.

Variance manipulation

Both of these functions allow the variance to be a three-dimensional array representing multiple variance matrices.

Other

Changes

threeDarr is new to the package.  It was written to streamline some tasks with Portfolio Probe, but is of general use.

By default there is now a warning in both var.shrink.eqcor and factor.model.stat if the input x is all non-negative.  This asks the question: Were prices accidentally given rather than returns?

There is now a sum.to.one argument to var.add.benchmark which can be set to FALSE if the “benchmark” is something with weights that do not sum to one.  The use case that prompted this was a vector of portfolio weights minus benchmark weights.

Research projects

The estimation of variance matrices in finance is (perhaps amazingly) not especially well researched.  The functionality in this package suggests several questions that would be nice to have answered:

Getting it

R: 2.13 and 2.14 on Windows

It is on CRAN, so you can just do:

install.packages("BurStFin")

This will also be the way to get it for new versions of R and/or BurStFin.

R: older versions on Windows

The 2.14 build is spread around the Burns Statistics repository.  So you can do:

install.packages("BurStFin", repos="http://www.burns-stat.com/R")

The help doesn’t work for older versions (because of changes in the help system), but the code is fine.

R: on other platforms

CRAN looks to have builds for 2.14 on Linux, MacOS and Solaris.  And of course it has the source.

S+

You can browse to http://www.burns-stat.com/Splus/BurStFin where you will find a dot-q file of the code that can be sourced, and a pdf of the help files.

Subscribe to the Portfolio Probe blog by Email

To leave a comment for the author, please follow the link and comment on their blog: Portfolio Probe » R language.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.