An R Package for testing the Efficient Market Hypothesis
R C++
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

emh v0.1.0 (beta)

emh is an R package designed to make testing the efficient market hypothesis as easy as possible.


emh provides a standardized interface to a number of randomness tests which have historically been used to measure the efficiency of markets. As of version 0.1.0 the randomness tests included in emh are,

Given a univariate zoo time series and a confidence interval, emh will execute each of these tests on the data at multiple frequencies / lags. The result is a data.frame containing frequencies, sample sizes, computed test statistics, p values, Z scores, and a boolean flag indicating whether or not the test indicates the data was non random.

All of this is done with one simple function call,



Linux and Mac

Try and install emh using the devtools package,


Linux, Mac, and Windows

And if you have trouble installing the package, then rather clone the respository to your local machine,

git clone

And then build and install the package either from RStudio or from the R command line tool.

And if you still run into issues please let me know on the GitHub issues page.


For examples of how to use the package once it is installed checkout the /examples directory. In there you will find a simple Jupyter notebook demonstrating how to use the emh package. For more information you can also checkout my website where I will be writing quite a bit about this package in the future: Turing Finance.


These are the plans for the future releases (contributions are welcome),

  • More univariate randomness tests,
    • Runs Tests:
      • The Monobit Test (on residuals)
      • The Longest Runs Test (on residuals)
      • The Random Excursions Test (on residuals)
      • The Random Excursions Variant Test (on residuals)
    • Unit Root Tests:
      • The Zivot-Andrews test for Unit Roots
      • The Phillips-Perron test for Unit Roots
      • The Augmented Dickey Fuller Test for Unit Roots (ADF)
      • The Extended ADF Test for Unit Roots (GLS-ADF)
      • The Kwiatkowski–Phillips–Schmidt–Shin Test for Unit Roots(KPSS)
    • Serial Correlation Tests:
      • The Overlapping Patterns Test (on residuals)
      • The Non-Overlapping Patterns Test (on residuals)
    • Variance Ratio Tests:
      • The Multiple Variance Ratio Test
      • Rank and Sign based Multiple Variance Ratio Test
    • Complexity Tests:
      • The Matrix Rank Test (on residuals)
      • The Linear Complexity Test (on residuals)
      • The Approximate Entropy Test (on residuals)
      • Lossless Compression Based Tests
      • Lossy Compression Based Tests
  • More stochastic processes (benchmarks),
    • The Noisy Sine Wave
    • The Heston Stochastic Volatility Model
    • The Ornstein-Uhlenbech Mean Reverting Model
    • The Cox-Ingersoll-Ross Mean Reverting Model
  • Some multivariate randomness tests
  • An ensemble of univariate tests