Giter Site home page Giter Site logo

johansencointegration's Introduction

JohansenCointegration

A C++ implementation of the Johansen Cointegration test

This is the first C/C++ implementation of Johansen's Cointegration test I'm aware of on the public Internet. It's based on a C# implementation from a poster named Vanna from quantcode.com.

This isn't the best code I've written but in my defense the algorithm is very involved and the original C# code was written by someone else. However it does in fact work and even has all the memory leaks worked out.

Prerequisites:

This class is based on the GNU Scientific Library (GSL) version 1.16. If you're on a *nix system this shouldn't be a problem. Just download and install it the usual way for your system. Google is your friend.

For Windows systems this is stickier. GSL does not officially provide library binaries for Windows; you'll either have to find a Windows binary package somewhere on the Interwebs or compile it yourself (not for the faint of heart). A fellow github member (ahmadyan) provided all the tools and detailed instructions necessary to do this. In fact I successfully created my own Windows GSL binaries using his instructions.

Build instructions for the Johansen Cointegration project:

On Linux, create a build subdirectory and go into it. Type "cmake .." followed by make.

On Windows, I uploaded the .sln and .vcxproj files for a Visual Studio 2013 project. Eventually I'll fix the CMakeLists.txt file to generate VS project files directly. The Visual Studio project is expecting your Windows-based GSL library to be in the top level directory of this project, parallel with the source files.

The main class for doing all the Johansen work is in JohansenHelper.h/.cpp. A command line program is contained in JohansenTest.cpp which uses the JohansenHelper. To demonstrate the cointegration function there are 4 test cases implemented in JohansenTest. These cases were covered in Vanna's quantcode postings on quantcode. S/he wrote many C# apps and online papers/FAQs which I encourage you to have a look at.

In particular, I referred to this article frequently: How do I interpret Johansens' test results? This is the article from where I got the 4 test cases.

Drop a line if you find this useful or have problems compiling or using this.

johansencointegration's People

Contributors

stevegee58 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.