outperformance.test {matiming} | R Documentation |
This function tests whether the moving average strategy outperforms its passive counterpart. All tests are based on using a bootstrap method.
outperformance.test(results, digits=3, to.annual=sqrt(12), type=c("ordinary", "block","stationary"), bLen=5, R=1000, automatic=FALSE)
results |
the results returned by function |
digits |
defines the number of digits after the decimal delimiter to use in reporting the performance of the moving average and buy-and-hold strategies |
to.annual |
a coefficient used to annualize the performance measure. For example, when
the performance is measured using either |
type |
determines the type of the bootstrap method. The default type is "ordinary" (the method of Efron, 1979). The two other types are "block" (the method of Kunsch, 1989) and "stationary" (the method of Politis and Romano, 1994) |
bLen |
a scalar that specifies the block length in the block-bootstrap method |
R |
a scalar that specifies the number of bootstrap replicates |
automatic |
a logical variable that specifies whether to compute the optimal block length for the block-bootstrap and stationary bootstrap |
The p-value of the outperformance test.
If results
are produced by back.test
, then this function
tests whether the best strategy in the back test outperforms the buy-and-hold strategy. Note that in this case the p-value is not ajdusted for the data-mining bias.
Otherwise, if results
are produced by forward.test
, then this function
tests whether the out-of-sample strategy outperforms the buy-and-hold strategy.
Regardless of the performance measure used (denoted by PM), this function performs the tests of the following null hypothesis: H_0: PM_{MA}≤q PM_{BH}, where PM_{MA} is the performance of the moving average strategy and PM_{BH} is the performance of the buy-and-hold strategy. In words, the null hypothesis is that the performance of the moving average strategy is not better than the performance of the buy-and-hold strategy.
All tests are based on non-parametric bootstrap methods. The three bootstrap methods that are implemented are: (1) the ordinary
bootstrap method of Efron (1979), (2) the block-bootstrap method of Kunsch (1989), and (3) the stationary block-bootstrap
method of Politis and Romano (1994). In a block-bootstrap method one needs to either specify manually the block length or
to allow the function to automatically determine the optimal block length. The optimal
block length is computed using the method described in Patton, Politis and White (2009). To determine
the optimal block length, function b.star
from package np
is used (Hayfield and Racine (2008)).
Efron, B., Bootstrap Methods: Another Look at the Jackknife. Annals of Statistics, 1979, 7, 1-26.
Kunsch, H.R., The Jacknife and the Bootstrap for General Stationary Observations. Annals of Statistics, 1989, 17, 1217-1241.
Politis, D. and Romano, J., The Stationary Bootstrap. Journal of the American Statistical Association, 1994, 89, 1303-1313.
Politis, D.N. and H. White (2004), Automatic block-length selection for the dependent bootstrap, Econometric Reviews 23 (1), 53-70.
Patton, A. and D.N. Politis and H. White (2009), CORRECTION TO: Automatic block-length selection for the dependent bootstrap by D. Politis and H. White, Econometric Reviews 28 (4), 372-375.
Hayfield, T. and J. Racine (2008). Nonparametric Econometrics: The np Package. Journal of Statistical Software, 27 (5).
Other strategy testing functions:
back.test()
,
forward.test()
# Suppose that "results" are the results of simulations of different trading strategies ## Not run: start.date <- as.Date("1930-01-01", format="%Y-%m-%d") end.is.date <- as.Date("1939-12-31", format="%Y-%m-%d") end.oos.date <- as.Date("2015-12-31", format="%Y-%m-%d") refit.every <- 5 include.bh <- TRUE res <- forward.test(results, start.date=start.date, end.is.date=end.is.date, end.oos.date=end.oos.date, refit.every=refit.every, include.bh=include.bh, FUN=Sortino) outperformance.test(res, type="stationary", automatic=TRUE) ## End(Not run)