Reworked section on multivariate correlations

My charts were mixing position vs time, which was pretty confusing.
I changed it to position vs velocity, and demonstrated how multipying
the covariances lead to a much better result.
This commit is contained in:
Roger Labbe
2015-02-01 20:39:08 -08:00
parent 9117261d25
commit 79387a85cb
3 changed files with 369 additions and 63 deletions

View File

@@ -330,6 +330,24 @@ def do_plot_test():
print (count / len(x))
from numpy.linalg import inv
from numpy import asarray, dot
def multivariate_multiply(m1, c1, m2, c2):
C1 = asarray(c1)
C2 = asarray(c2)
M1 = asarray(m1)
M2 = asarray(m2)
sum_inv = inv(C1+C2)
C3 = dot(C1, sum_inv).dot(C2)
M3 = (dot(C2, sum_inv).dot(M1) +
dot(C1, sum_inv).dot(M2))
return M3, C3
def norm_cdf (x_range, mu, var=1, std=None):
""" computes the probability that a Gaussian distribution lies