Blog Archives

R Sapply Problem

Any expert in R please educates me. I have got a problem about the sapply (or lapply), it made me headache for over two hours.As "for loop" is very slow in R, we should try best to avoid using it, and to use vectorization instead. sapply is designed for this, for example, instead of:for (i in 1:10) {z <-...

Read more »

R for Matlab Users

My favorite software is Matlab, but partly because R is free, more and more people & companies choose to use R as a major working language. Nothing wrong with that, I am at the moment changing some of my Kalman Filter Matlab codes to R.One bothering issue is each software has its own...

Read more »

An Interest Rate R Package Plan

An Interest Rate R Package Plan

I recently have done some empirical studies on zero-coupon bond modelling and pricing, and plan to create an interest rate R package in order to make it re-usable, as I find there are only two R package on it, one is http://cran.r-project.org/web/pack...

Read more »

How to Create an R Package in Windows

How to Create an R Package in Windows

There are many reasons to create an R package, such as codes protection, convenient usage, etc. However, creating an R package in Unix is not hard, it IS in Windows, as R is designed in a Unix environment which includes a set of compilers, programming utilities, and text-formatting routines while Windows lacks those. I used to build an R...

Read more »

Missing data imputation

December 12, 2009
By
Missing data imputation

Probably all of us have met the issue of handling missing data, from the basic portfolio correlation matrix estimation, to advanced multiple factor analysis, how to impute missing data remains a hot topic. Missing data are unavoidable, and more encompassing than the ubiquitous association of the term, irgoring missing data will generally lead to biased estimates. The...

Read more »

RQuantlib

November 23, 2009
By

Quantlib is a free library for modeling, trading, and risk management in real-life providing a comprehensive software framework for quantitative finance, it is written in C++, which might be inconvenient for some users. JQuantLib aiming at Java-fans i...

Read more »

Test cointegration with R

Cointegrated pairs of securities are crucial for mean reversion trading portfolio construction, Play with cointegration has several good papers to start with. Should you want to test pairs of securities for cointegration using R, here is an excellent ...

Read more »

Nonparametric High-Dimensional Time Series Analysis

Functional Gradient Descent (FGD) is a method of nonparametric time series analysis, useful in particular for estimating conditional mean, variances and covariances for very high-dimensional time series. FGD is a kind of hybrid of nonparametric statis...

Read more »

Maximum likelihood estimation in R

Maximum likelihood estimation can be implemented like Quasi-maximum likelihood in Matlab, You can also write an R function which computes out the likelihood function. As always in R, this can be done in several different ways.One issue is that of rest...

Read more »

Extra moments measure

December 16, 2008
By

The following functions are intended to replicate calculations for taking higher moments of hedge fund returns into account in analyzing particular investments.  Most of the formulae are taken from various EDHEC research papers.# All returns...

Read more »