Python for Finance: Analyze Big Financial Data
Further Reading The original article introducing Monte Carlo simulation to finance is: Boyle, Phelim (1977): “Optio ...
[ 36 ] Cf. http://docs.scipy.org/doc/numpy/reference/routines.random.html. [ 37 ] Cf. http://docs.scipy.org/doc/numpy/refere ...
Chapter 11. Statistics I can prove anything by statistics except the truth. — George Canning Statistics is a vas ...
for an overview of handling such data with Python, NumPy, and pandas. ...
Normality Tests The normal distribution can be considered the most important distribution in finance and one ...
For what follows we need a number of Python libraries, including scipy.stats and statsmodels.api: In [ 1 ]: ...
Figure 11-1. Ten simulated paths of geometric Brownian motion Consider the very first simulated path ...
print “%14s %15.5f” % (‘skew’, sta[ 4 ]) print “%14s %15.5f” % (‘kurtosis’, sta[ 5 ]) For example, the following ...
plt.grid(True) plt.xlabel(‘theoretical quantiles’) plt.ylabel(‘sample quantiles’) Figure 11-3. Quantile-quantile plot ...
Finally, let us check whether the end-of-period values are indeed log-normally distributed. This boils down t ...
Out[18]: Skew of data set -0.001 Skew test ...
distributed or not. Real-World Data We are now pretty well equipped to attack real-world data and see how the n ...
Figure 11-7. Evolution of stock and index levels over time Calculating the log returns with pandas is a ...
As a next step, consider the different statistics for the time series data sets. The kurtosis values seem ...
Figure 11-9. Quantile-quantile plot for S&P 500 log returns The same conclusions can be drawn from Fig ...
––––––––––— Skew of data set 0.565 ...
Portfolio Optimization Modern or mean-variance portfolio theory (MPT) is a major cornerstone of financial theory ...
Figure 11-11. Stock prices over time Mean-variance refers to the mean and variance of the (log) returns of ...
You can now check that the asset weights indeed add up to 1; i.e., Iwi = 1, where I is the number of ...
Equipped with the portfolio covariance matrix, Equation 11-3 then provides the formula for the expected ...
«
10
11
12
13
14
15
16
17
18
19
»
Free download pdf