code: def arma_explicit_logp(y, ar_coefs, ma_coefs, level_scale):
      """Manual log-prob computation for arma(p, q) process."""
      # Source: page 132 of
      # http://www.ru.ac.bd/stat/wp-content/uploads/sites/25/2019/03/504_02_Hamilton_Time-Series-Analysis.pdf
      p = len(ar_coefs)
      q = len(ma_coefs)
      t = len(y)
  
      # For the first few steps of y, where previous values
      # are not available, we model them as zero-mean with
      # stddev `prior_scale`.
      e = np.zeros([t])
      for i in range(p):
          zero_padded_y = np.zeros([p])
          zero_padded_y[p - i : p] = y[:i]
          pred_y = np.dot(zero_padded_y, ar_coefs[::-1])
          e[i] = y[i] - pred_y
  
      for i in range(p, len(y)):
          pred_y = np.dot(y[i - p : i], ar_coefs[::-1]) + np.dot(
              e[i - q : i], ma_coefs[::-1]
          )
          e[i] = y[i] - pred_y
      lp = (
          -((t - p) / 2) * np.log(2 * np.pi)
          - ((t - p) / 2) * np.log(level_scale**2)
          - np.sum(e**2 / (2 * level_scale**2))
      )
  
      return lp
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_diag
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.sts.components.autoregressive import AutoregressiveStateSpaceModel
  from tensorflow_probability.python.sts.components.autoregressive_moving_average import AutoregressiveMovingAverageStateSpaceModel
label_desc: Use image node_id 1 for calling a global function with example usage: arma_explicit_logp(y, ar_coefs, ma_coefs, level_scale) and returns: lp