We generate data from a synthetic $d \times T$-dimensional Gaussian probabilistic model.


In [8]:


In [23]:
d = 400
T = 100
x = zeros((d,T))
y = zeros((d,T))

a = 0.5
tauPsi = 1.
tauRho = 1.
tauPhi = 10.

Q = zeros((2*d,2*d))
# First x
Q[0,0] = tauPsi + tauRho + tauPhi
Q[0,1] = -tauPsi
Q[0,d] = -tauPhi
Q[d,0] = -tauPhi
# Last x
Q[d-1,d-1] = tauPsi + tauRho + tauPhi
Q[d-1,d-2] = -tauPsi
Q[d-1,2*d-1] = -tauPhi
Q[2*d-1,d-1] = -tauPhi
for i in range(d)[1:d-1]:
    Q[i,i] = 2*tauPsi + tauRho + tauPhi
    Q[i,i-1] = -tauPsi
    Q[i,i+1] = -tauPsi
    Q[i,i+d] = -tauPhi
    Q[i+d,i] = -tauPhi

for i in range(d):
    Q[i+d,i+d] = tauPhi

P = inv(Q)

xExtended = random.multivariate_normal(zeros(2*d), P)
x[:,0] = xExtended[:d]
y[:,0] = xExtended[d:]

for t in arange(1,T):
    print t
    temp = r_[x[:,t-1],zeros(d)]
    mu = tauRho*a*dot(P,temp)
    xExtended = random.multivariate_normal(mu, P)
    x[:,t] = xExtended[:d]
    y[:,t] = xExtended[d:]
    
savetxt('simulatedData/d'+str(d)+'tauPhi'+str(tauPhi)+'y.txt', y)
savetxt('simulatedData/d'+str(d)+'tauPhi'+str(tauPhi)+'P.txt',P)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

In [11]:


In [13]:


In [98]:
imshow(abs(x-y))
colorbar()


Out[98]:
<matplotlib.colorbar.Colorbar instance at 0x7f4c4c1e1b90>

In [47]:


In [48]:


In [81]:


In [6]:
test1 = arange(3)
test2 = arange(5,9)

In [7]:
r_[test1,test2]


Out[7]:
array([0, 1, 2, 5, 6, 7, 8])

In [16]:
test = array([i+1.5 for i in range(10)])

In [14]:
test = zeros(5)

In [17]:
test


Out[17]:
array([  1.5,   2.5,   3.5,   4.5,   5.5,   6.5,   7.5,   8.5,   9.5,  10.5])

In [ ]: