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

Adrian Dragulescu adrian_d at eskimo.com
Sun Feb 10 16:21:37 CET 2008


You may want to check the package meboot and the underlying theory.  The
approach does maintain the dependence structure of your time series and
works both in an univariate or multivariate setting.

Adrian


On Sat, 9 Feb 2008, 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?
>
> 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
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>



More information about the R-SIG-Finance mailing list