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

elton wang ahala2000 at yahoo.com
Sat Feb 9 16:05:28 CET 2008


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? 

Thanks!




--- "Brian G. Peterson" <brian at braverock.com> wrote:

> elton wang wrote:
> > Here is a beginner question:
> > what would be your perferred method if we want to
> > simulate the stock market for back testing a
> trading
> > strategy? 
> > Using sp500 daily data as example, if given the
> > knowledge that historical data has time varying
> > volatility, autocorrelations etc? just fitting a
> > GARCH(1,1) or doing historical resampling? 
> (simply
> > divided the data to in-sample and out sample may
> not
> > be sufficient, am I right?)
> 
> You've bitten off one of the most complex and
> studied problems in finance.
> 
> Kalman filtering is often applied to build bands and
> trends, as are 
> straightforward standard deviation based measures
> such as "Bollinger bands".
> 
> Any of the AR methods ARMA, ARIMA, GARCH allow for
> time-varying changes 
> in level and volatility.
> 
> Refinement of those models generally involves EMM or
> Bayesian evolution 
> of the moments.
> 
> These can all be used as one- or multiple-
> step-ahead prediction methods.
> 
> In general, these predictions would be used as
> inputs to *create* a 
> trading strategy.  You would then backtest your
> strategy by setting up a 
> "learning period" (length depending on the frequency
> of your data), and 
> then letting the model evolve on an out-of-sample
> basis (by making one 
> step ahead or similar predictions).
> 
> If you then wanted to further test your models, you
> could fit various 
> distributions to historical data and simulate
> historical series from 
> these distributions.  I'm not really a fan of the
> pure simulation 
> approach unless you are very careful and know what
> you're doing, because 
> there is a huge amount of model risk (risk that you
> will mis-specify 
> starting parameters and therefore get worthless
> results) involved in 
> these pure simulation approaches.
> 
> Many Bayesian (and other Monte Carlo) methods use
> simulation to inform 
> their predictions, but this is different than
> constructing purely 
> hypothetical historical series to test a model
> against.
> 
> Regards,
> 
>     - Brian
> 



      ____________________________________________________________________________________
Be a better friend, newshound, and



More information about the R-SIG-Finance mailing list