Esempio n. 1
0
 def test_seeded_run(self):
     random.seed(1)
     m = AR(c=1, sigma=1, pcoeff=[1, -1, 0.5])
     x = m.generate(10)
     expected = [
         2.28818475, 4.73763036, 3.51578142, 0.15769978, -1.08143967,
         1.55008577, 2.68827216, 0.16063711, -0.55328019, 1.76359339
     ]
     assert x == pytest.approx(expected)
Esempio n. 2
0
 def test_periodic(self):
     m = AR(c=1, sigma=0, pcoeff=[1, -1])
     x = m.generate(10)
     assert x == [1.0, 2.0, 2.0, 1.0, 0.0, 0.0, 1.0, 2.0, 2.0, 1.0]
Esempio n. 3
0
 def test_linear_using_buffer(self):
     m = AR(c=1, sigma=0, pcoeff=[1], x_buff=[4])
     x = m.generate(10)
     assert x == [float(x) for x in range(5, 15)]
Esempio n. 4
0
 def test_white_noise(self):
     m = AR(c=0, sigma=1, pcoeff=[])
     s = pd.Series(m.generate(1000))
     assert s.std() == pytest.approx(1.0, abs=1e2)
     assert s.mean() == pytest.approx(0.0, abs=1e2)
Esempio n. 5
0
 def test_linear_multiple_calls(self):
     m = AR(c=1, sigma=0, pcoeff=[1])
     x = m.generate(10)
     assert x == [float(x) for x in range(1, 11)]
     x = m.generate(10)
     assert x == [float(x) for x in range(11, 21)]
Esempio n. 6
0
 def test_linear(self):
     m = AR(c=1, sigma=0, pcoeff=[1])
     x = m.generate(10)
     assert x == [float(x) for x in range(1, 11)]
Esempio n. 7
0
 def test_constant_generation(self):
     m = AR(c=1, sigma=0)
     x = m.generate(10)
     assert x == [1] * 10
Esempio n. 8
0
 def test_no_unwanted_api_params(self):
     with pytest.raises(TypeError):
         m = AR(mu=0.0, qcoeff=[])
Esempio n. 9
0
 def test_default_creation(self):
     m = AR()
     assert m