Hello,

I want estimate the parameters of 2D Ornstein Uhlenbeck Process, my data are the following:

I’m wondering if the attempt to estimate the parameters of this model with Euler-Maruyama class is correct.

Given the OU sde

dX_t = \Theta(\mu - X_t)dt + \sigma dW_t

I’ve built the following model:

```
with pm.Model() as model:
Theta = pm.Flat('Theta', shape=2)
sigma = pm.Flat('sigma', shape=2, testval=1)
u = pm.Uniform('u', -1, 1, shape=2)
def lin_sde(x, Theta, u):
return Theta * (u-x), sigma
with model:
# hidden states following a OU SDE
X = EulerMaruyama('X', dt, lin_sde, (Theta, u), shape=(len(eweValence), 2), testval=np.zeros(shape=(len(eweValence),2)))
Z = pm.Normal('Z', mu=X, sd=sigma, shape=(len(eweValence), 2), observed = obs)
inference_result = Inference('MCMC')
```

the Inference function is:

```
def MCMC():
start = pm.find_MAP(vars=[X], method="L-BFGS-B")
step = pm.NUTS(scaling=start)
trace = pm.sample(2000, step=step)
step = pm.NUTS(scaling=trace[-1], gamma=.25)
trace = pm.sample(1000, step, start=trace[-1], progressbar=True, random_seed=SEED)
return trace
```

The trace result and sample_ppc() are the following:

the first plot is the real data.

Is this a good attempt to estimate the parameters? and \theta should not it be positive? How can I proof the model’s correctness?