class_docstr: Inherits time series methods from TSM parent class.
  
  **** AUTOREGRESSIVE INTEGRATED MOVING AVERAGE EXOGENOUS (ARIMAX) MODELS ****
  
  Parameters
  ----------
  data : pd.DataFrame
      Field to specify the univariate time series data that will be used.
  
  formula : string
      patsy string notation describing the regression
  
  ar : int
      Field to specify how many AR lags the model will have.
  
  ma : int
      Field to specify how many MA lags the model will have.
  
  integ : int (default : 0)
      Specifies how many times to difference the time series.
  
  family : family object
      E.g pf.Normal(), pf.t(), pf.Laplace()...
class_docstr_tok: ["Inherits","time","series","methods","from","TSM","parent","class",".","*","*","*","*","AUTOREGRESSIVE","INTEGRATED","MOVING","AVERAGE","EXOGENOUS","(","ARIMAX",")","MODELS","*","*","*","*","Parameters","--","--","--","--","--","data",":","pd.DataFrame","Field","to","specify","the","univariate","time","series","data","that","will","be","used",".","formula",":","string","patsy","string","notation","describing","the","regression","ar",":","int","Field","to","specify","how","many","AR","lags","the","model","will","have",".","ma",":","int","Field","to","specify","how","many","MA","lags","the","model","will","have",".","integ",":","int","(","default",":","0",")","Specifies","how","many","times","to","difference","the","time","series",".","family",":","family","object","E.g","pf.Normal","(",")",",","pf.t","(",")",",","pf.Laplace","(",")","..."]
docstr: Creates the structure of the model (model matrices, etc) for
  a mini-batch non-Normal family ARIMAX model. Here we apply a link function.
  
  Here the structure is the same as for _non_normal_model() but we are going to
  sample a random choice of data points (of length mini_batch).
  
  Parameters
  ----------
  beta : np.ndarray
      Contains untransformed starting values for the latent variables
  
  mini_batch : int
      Mini batch size for the data sampling
  
  Returns
  ----------
  mu : np.ndarray
      Contains the predicted values (location) for the time series
  
  Y : np.ndarray
      Contains the length-adjusted time series (accounting for lags)
docstr_tok: ["Creates","the","structure","of","the","model","(","model","matrices",",","etc",")","for","a","mini-batch","non-Normal","family","ARIMAX","model",".","Here","we","apply","a","link","function",".","Here","the","structure","is","the","same","as","for","_non_normal_model","(",")","but","we","are","going","to","sample","a","random","choice","of","data","points","(","of","length","mini_batch",")",".","Parameters","--","--","--","--","--","beta",":","np.ndarray","Contains","untransformed","starting","values","for","the","latent","variables","mini_batch",":","int","Mini","batch","size","for","the","data","sampling","Returns","--","--","--","--","--","mu",":","np.ndarray","Contains","the","predicted","values","(","location",")","for","the","time","series","Y",":","np.ndarray","Contains","the","length-adjusted","time","series","(","accounting","for","lags",")"]
code: def _mb_non_normal_model(self, beta, mini_batch):
      """Creates the structure of the model (model matrices, etc) for
      a mini-batch non-Normal family ARIMAX model. Here we apply a link function.
  
      Here the structure is the same as for _non_normal_model() but we are going to
      sample a random choice of data points (of length mini_batch).
  
      Parameters
      ----------
      beta : np.ndarray
          Contains untransformed starting values for the latent variables
  
      mini_batch : int
          Mini batch size for the data sampling
  
      Returns
      ----------
      mu : np.ndarray
          Contains the predicted values (location) for the time series
  
      Y : np.ndarray
          Contains the length-adjusted time series (accounting for lags)
      """
  
      rand_int = np.random.randint(
          low=0, high=self.data_length - mini_batch - self.max_lag + 1
      )
      sample = np.arange(start=rand_int, stop=rand_int + mini_batch)
  
      data = self.y[sample]
      X = self.X[sample, :]
      Y = data[self.max_lag :]
  
      if self.ar != 0:
          ar_matrix = data[(self.max_lag - 1) : -1]
          for i in range(1, self.ar):
              ar_matrix = np.vstack(
                  (ar_matrix, data[(self.max_lag - i - 1) : -i - 1])
              )
      else:
          ar_matrix = np.zeros(data.shape[0] - self.max_lag)
  
      # Transform latent variables
      z = np.array(
          [
              self.latent_variables.z_list[k].prior.transform(beta[k])
              for k in range(beta.shape[0])
          ]
      )
  
      # Constant and AR terms
      if self.ar == 0:
          mu = np.transpose(ar_matrix)
      elif self.ar == 1:
          mu = (
              np.transpose(ar_matrix)
              * z[: -self.family_z_no - self.ma - len(self.X_names)][0]
          )
      else:
          mu = np.matmul(
              np.transpose(ar_matrix),
              z[: -self.family_z_no - self.ma - len(self.X_names)],
          )
  
      # X terms
      mu = mu + np.matmul(
          X[self.integ + self.max_lag :],
          z[
              self.ma
              + self.ar : (self.ma + self.ar + len(self.X_names))
          ],
      )
  
      # MA terms
      if self.ma != 0:
          mu = arimax_recursion(
              z,
              self.link(mu),
              Y,
              self.max_lag,
              Y.shape[0],
              self.ar,
              self.ma,
          )
  
      return mu, Y
  
imports: import sys
  import numpy
  import pandas
  import scipy.stats
  import scipy.special
  from patsy import dmatrices, dmatrix, demo_data
  from ..None import families
  from ..None import output
  from ..None import tests
  from ..None import tsm
  from ..None import data_check
  from .arma_recursions import arimax_recursion
label_desc: Use image node_id 9 for calling the ARIMAX obj's underlying member method code with example usage: obj._mb_non_normal_model(beta, mini_batch) and returns: mu,  Y