code: def build_model():
      y = shared(
          np.array([15, 10, 16, 11, 9, 11, 10, 18], dtype=np.float32)
      )
      with pm.Model() as arma_model:
          sigma = pm.HalfNormal("sigma", 5.0)
          theta = pm.Normal("theta", 0.0, sigma=1.0)
          phi = pm.Normal("phi", 0.0, sigma=2.0)
          mu = pm.Normal("mu", 0.0, sigma=10.0)
  
          err0 = y[0] - (mu + phi * mu)
  
          def calc_next(last_y, this_y, err, mu, phi, theta):
              nu_t = mu + phi * last_y + theta * err
              return this_y - nu_t
  
          err, _ = scan(
              fn=calc_next,
              sequences=dict(input=y, taps=[-1, 0]),
              outputs_info=[err0],
              non_sequences=[mu, phi, theta],
          )
  
          pm.Potential("like", pm.Normal.dist(0, sigma=sigma).logp(err))
      return arma_model
  
imports: import numpy
  from theano import scan, shared
  import arviz
  import pymc3
label_desc: Use image node_id 1 for calling a global function with example usage: build_model() and returns: arma_model, unknown