[R-SIG-Finance] Random numbers with positive skewness

James Toll james at jtoll.com
Sat Jul 18 05:33:30 CEST 2009


I've been debating how to go about acquiring the historical data  
necessary to backtest an indexing idea and I finally decided that  
maybe I should first try it out on some randomly generated time series  
data. So, for starters, I need to generate 100 time series to  
represent 100 different equities, like, for example, the OEX.  To take  
the place of 10 years of closing prices, I thought I could simply  
generate 2520 price relatives using something along the lines of this:

x <- rnorm(2520, mean = 1, sd = 0.02)

But obviously, it's not likely that each of the components of a cap  
weighted index of 100 equities is going to have price relatives with  
an SD of 0.02.  So I'd like to be able to vary the SD for each.  I  
thought I could just as easily randomly generate a vector of SD's for  
use in generating each time series like so:

y<-rnorm(100, mean = 0.025, sd = 0.007)

The problem I'm running into is that when generating the SD's for each  
of the 100 time series my wild guess is that the mean might be  
somewhere between 0.02 and 0.03, and I think the SD might be somewhere  
around 0.007, but I don't think a normal distribution really works at  
all.  I think I need a lot of positive skewness to the distribution.

BTW, all of these wild guesses are simply based upon my experience as  
an option market maker (which may be worthless to this task), and  
there are lots of equities that normally trade between 30 and 50  
volatility, but then I've also traded tech stocks with vols around 80  
and 90.  So basically I think the bulk of the distribution of SD's is  
between 0.02 and 0.03, they taper off on the left side around 0.01,  
maybe a little lower, but then on the right side the long tail goes up  
to around 0.06.  If my assumptions / conclusions are totally off base  
please feel free to tell me.  This is definitely my first attempt at  
any kind of backtesting.

Is there some other method of generating random numbers that will  
allow me to control the skewness of the distribution?  Thanks.


More information about the R-SIG-Finance mailing list