diff --git a/pybasicbayes/testing/dynglm_optimisation_test.py b/pybasicbayes/testing/dynglm_optimisation_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..85c267f53c33fc4db32d45b65b73e33bf3408653
--- /dev/null
+++ b/pybasicbayes/testing/dynglm_optimisation_test.py
@@ -0,0 +1,49 @@
+"""
+Need to find out whether loglikelihood is computed correctly.
+
+Or whether a bug here allows states to invade each other more easily.
+We'll test this by comparing to pymc results.
+"""
+import numpy as np
+from dynamic_glm import Dynamic_GLM
+import pickle
+import matplotlib.pyplot as plt
+
+# Testing of Dynamic_GLM implementation
+np.set_printoptions(suppress=True)
+
+seed = np.random.randint(10000)  # 215
+print(seed)
+seed = 5489
+np.random.seed(seed)
+
+
+T = 16
+n_inputs = 3
+step_size = 0.2
+Q = np.tile(np.eye(n_inputs), (T, 1, 1))
+test = Dynamic_GLM(n_inputs=n_inputs, T=T, P_0=4 * np.eye(n_inputs), Q=Q * step_size, prior_mean=np.zeros(n_inputs))
+w = np.zeros(n_inputs)
+
+test_points = [0]
+predictors = []
+a, b = np.zeros(1000), np.zeros(1000)
+a[250:500] = 1
+a[750:1000] = 1
+b[500:] = 1
+for _ in range(T):
+    if _ in [0, 1, 8, 9, 10, 11, 12, 14, 15]:
+        predictors.append(np.empty((0, n_inputs)))
+        continue
+    t = 1000
+    pred = np.empty((t, n_inputs))
+    pred[:, 0] = a
+    pred[:, 1] = b
+    pred[:, 2] = 1
+    predictors.append(pred)
+sample = test.rvs(predictors, list(range(T)))
+pickle.dump(sample, open('test_data', 'wb'))
+pickle.dump(test, open('truth', 'wb'))
+
+plt.plot(test.weights)
+plt.show()
diff --git a/pybasicbayes/testing/test_data b/pybasicbayes/testing/test_data
new file mode 100644
index 0000000000000000000000000000000000000000..0c79466950726e3dd85a57038135ee98cfc63ff4
Binary files /dev/null and b/pybasicbayes/testing/test_data differ
diff --git a/pybasicbayes/testing/truth b/pybasicbayes/testing/truth
new file mode 100644
index 0000000000000000000000000000000000000000..65de7816b3e0374a51ec2315b4f3698f4afd7f38
Binary files /dev/null and b/pybasicbayes/testing/truth differ