descriptive.statistics {matiming} | R Documentation |
This function computes the summary statistics of the moving average trading strategy and the corresponding buy-and-hold strategy
descriptive.statistics(results, nobs.a.year = 12, to.annual=sqrt(12), type=c("ordinary", "block", "stationary"), bLen=5, R=1000, automatic=FALSE, plot.results=FALSE)
results |
the results returned by function |
nobs.a.year |
a scalar that defines the number of observations a year. For example, for monthly data the number of observations a year equals 12 |
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 |
plot.results |
a logical value indicating whether to plot the cumulative returns and drawdowns to the moving average strategy and the buy-and-hold strategy |
An object of class data.frame
containing two columns: BH
and MA
.
The first column contains the summary statistics for the Buy-and-Hold strategy, the second
column contains the summary statistics for the Moving Average strategy.
Each column contains the following rows:
annualized mean returns
annualized standard deviation
minimum return
maximum return
skewness of return distribution
kurtosis of return distribution
Average drawdown
Average of the 10 largest drawdowns
Maximum drawdown
Performance measure
P-value of the test of outperformance
Probability that the moving average strategy outperforms its passive counterpart over a 5-year horizon
Probability that the moving average strategy outperforms its passive counterpart over a 10-year horizon
The length of the tested period should be longer than 10 years (this is needed to compute the Rolling 10-year Win).
P-value is the p-value of the outperformance test. This p-value is computed in the same
manner as in function outperformance.test
.
If results
are produced by back.test
, then this function
computes the descriptive statistics and the p-value of the best strategy in the back test. In this case the p-value is not adjusted for the data-mining bias; hence,
this p-value is unreliable. Otherwise, if results
are produced by forward.test
, then this function
computes the descriptive statistics and the p-value of the out-of-sample strategy.
Other strategy summary functions:
best.is.strategies()
## Not run: library(matiming) library(xtable) library(zoo) data <- sp500.monthly dates <- index(data) data <- coredata(data) capret <- data[,"CAP"] totret <- data[,"TOT"] rfret <- data[,"RF"] tc <- 0.0025 fast <- 1:9 slow <- 2:18 res.mac <- sim.mac.strategy(totret=totret, rfret=rfret, dates=dates, capret=capret, tc=tc, fast=fast, slow=slow, FUN=SMA) res.mom <- sim.mom.strategy(totret=totret, rfret=rfret, dates=dates, capret=capret, tc=tc, winsize=slow) results <- sim.results.merge(res.mac, res.mom) start.date <- as.Date("1920-01-01", format="%Y-%m-%d") end.is.date <- as.Date("1943-12-31", format="%Y-%m-%d") end.oos.date <- as.Date("2015-12-31", format="%Y-%m-%d") refit.every <- 1 rolling <- FALSE res <- forward.test(results, start.date, end.is.date, end.oos.date, refit.every=refit.every, rolling=rolling, FUN=Sharpe) df <- descriptive.statistics(res, plot.results=TRUE) xtab <- xtable(df, digits=2) print(xtab) ## End(Not run)