# How do I solve two factors model?

I’m trying to find MAP of such model:
dX_t = μ * (θ_t − X_t)dt + σ * dB_t
dθ_t = k * (\bar{θ} − θ_t)dt + \bar{σ} * dB_t

Different from the general linear sde, one parameter in the first sde is also a stochastic process.
I use the following code to solve this model.

def lin_sde_theta(theta, k, theta_bar, sigma_bar):
return k * (theta_bar - theta), sigma_bar

def lin_sde_x(x, mu, theta, sigma):
return mu * (theta - x), sigma

with pm.Model() as model:

theta_bar = pm.Uniform('theta_bar', 0, 1)
sigma_bar  = pm.Uniform('sigma_bar', 0, 1)
k  = pm.Uniform('k', 0, 1)
mu = pm.Uniform('mu', 0, 1)
sigma  = pm.Uniform('sigma', 0, 1)

# hidden states following a OU SDE
Theta = EulerMaruyama('Theta', dt, lin_sde_theta, (k, theta_bar, sigma_bar), shape=N, testval=theta_t)

X = EulerMaruyama('X', dt, lin_sde_x, (mu, Theta, sigma), shape=N, observed=S_t)


When I tried to run the code, there was an error:

TypeError: 'numpy.float64' object cannot be interpreted as an integer.


How do I use the package to solve such model? Note that there are 5 parameters here.

seems it is complaining about dt being a float - try casting it to int should help.