Python for Finance: Analyze Big Financial Data

(Elle) #1

Further Reading


The following online resources are helpful:


Information about the SciPy statistical functions is found here:


http://docs.scipy.org/doc/scipy/reference/stats.html.


Also consult the documentation of the statsmodels library:


http://statsmodels.sourceforge.net/stable/.


For the optimization functions used in this chapter, refer to


http://docs.scipy.org/doc/scipy/reference/optimize.html.


There is a short tutorial available for PyMC3; at the time of this writing the library is


still in early release mode and not yet fully documented.


Useful references in book form are:


Copeland, Thomas, Fred Weston, and Kuldeep Shastri (2005): Financial Theory and


Corporate Policy, 4th ed. Pearson, Boston, MA.


Downey, Allen (2013): Think Bayes. O’Reilly, Sebastopol, CA.


Geweke, John (2005): Contemporary Bayesian Econometrics and Statistics. John


Wiley & Sons, Hoboken, NJ.


Rachev, Svetlozar et al. (2008): Bayesian Methods in Finance. John Wiley & Sons,


Hoboken, NJ.


[ 41 ]

Cf. Markowitz, Harry (1952): “Portfolio Selection.” Journal of Finance, Vol. 7, 77-91.

[ 42 ]

An alternative to np.sum(x) - 1 would be to write np.sum(x) == 1 taking into account that with Python the

Boolean True value equals 1 and the False value equals 0.

[ 43 ]

Note that we work here — and in the section to follow on Bayesian statistics — with absolute stock prices and not

with return data, which would be more statistically sound. The reason for this is that it simplifies intuition and makes

graphical plots easier to interpret. In real-world applications, you would use return data.

[ 44 ]

For a Python-based introduction into these and other fundamental concepts of Bayesian statistics, refer to Downey

(2013).

[ 45 ]

This example and the one in the following subsection are from a presentation by Thomas Wiecki, one of the lead

developers of PyMC3; he allowed me to use them for this chapter, for which I am most grateful.

[ 46 ]

Cf. http://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo. For example, the Monte Carlo algorithms used

throughout the book and analyzed in detail in Chapter 10 all generate so-called Markov chains, since the immediate next

step/value only depends on the current state of the process and not on any other historic state or value.

[ 47 ]

Note also here that we are working with absolute price levels and not return data, which would be statistically more

sound. For a real-world (trading) application, you would rather choose the return data to implement such an analysis.
Free download pdf