[R-SIG-Finance] Simulate the stock market for back testing strategy ---R bootstrap function

Dirk Eddelbuettel edd at debian.org
Sat Feb 9 16:39:08 CET 2008


On 9 February 2008 at 07:05, elton wang wrote:
| Thanks for Brian's reply.
| to make this  more relevant to this list, what
| functions in R can do bootstrap resampling while
| keeping the autocorrelation in the original data? (I
| only know function of sample()). Would this resmapled
| data do any good on back testing? 

No. 

But any decent book on bootstrapping mentions the problem, and many theses
and papers were (are ?) written on the issue. I haven't looked in a while, 
but 'block bootstrap' once was a popular idea for this. And an ad-hoc method
I used five or six years ago for low-frequency (monthly) data was to sample
in two stages 
	first sample an integer (say between 1 and 6) to determine how 'large'
		a chunk I would fetch
	then sample an integer between 1 and N to determine where I pick the
		chunk from
and re-constitute resample series this way.  As I said, 'ad-hoc'.  There are
many other ways.   But don't do just sample() as it is guaranteed to break
any possible structure in the correlation your data.

Hth, Dirk

-- 
Three out of two people have difficulties with fractions.



More information about the R-SIG-Finance mailing list