class_docstr: Inherits time series methods from TSM class.
  
  **** BETA-t-EGARCH IN MEAN REGRESSION MODELS ****
  
  Parameters
  ----------
  data : pd.DataFrame
      Field to specify the time series data that will be used.
  
  p : int
      Field to specify how many GARCH terms the model will have.
  
  q : int
      Field to specify how many SCORE terms the model will have.
  
  formula : string
      patsy string describing the regression
class_docstr_tok: ["Inherits","time","series","methods","from","TSM","class",".","*","*","*","*","BETA-t-EGARCH","IN","MEAN","REGRESSION","MODELS","*","*","*","*","Parameters","--","--","--","--","--","data",":","pd.DataFrame","Field","to","specify","the","time","series","data","that","will","be","used",".","p",":","int","Field","to","specify","how","many","GARCH","terms","the","model","will","have",".","q",":","int","Field","to","specify","how","many","SCORE","terms","the","model","will","have",".","formula",":","string","patsy","string","describing","the","regression"]
docstr: Creates the structure of the model
  
  Parameters
  ----------
  beta : np.array
      Contains untransformed starting values for latent variables
  
  Returns
  ----------
  lambda : np.array
      Contains the values for the conditional volatility series
  
  Y : np.array
      Contains the length-adjusted time series (accounting for lags)
  
  scores : np.array
      Contains the score terms for the time series
docstr_tok: ["Creates","the","structure","of","the","model","Parameters","--","--","--","--","--","beta",":","np.array","Contains","untransformed","starting","values","for","latent","variables","Returns","--","--","--","--","--","lambda",":","np.array","Contains","the","values","for","the","conditional","volatility","series","Y",":","np.array","Contains","the","length-adjusted","time","series","(","accounting","for","lags",")","scores",":","np.array","Contains","the","score","terms","for","the","time","series"]
code: def _model(self, beta):
      """Creates the structure of the model
  
      Parameters
      ----------
      beta : np.array
          Contains untransformed starting values for latent variables
  
      Returns
      ----------
      lambda : np.array
          Contains the values for the conditional volatility series
  
      Y : np.array
          Contains the length-adjusted time series (accounting for lags)
  
      scores : np.array
          Contains the score terms for the time series
      """
  
      Y = np.array(self.data[self.max_lag : self.data.shape[0]])
      X = np.ones(Y.shape[0])
      scores = np.zeros(Y.shape[0])
  
      # Transform latent variables
      parm = np.array(
          [
              self.latent_variables.z_list[k].prior.transform(beta[k])
              for k in range(beta.shape[0])
          ]
      )
  
      lmda = np.zeros(Y.shape[0])
      theta = np.zeros(Y.shape[0])
  
      # Loop over time series
      for t in range(0, Y.shape[0]):
          if t < self.max_lag:
              lmda[t] = parm[-len(self.X_names) * 2] / (
                  1 - np.sum(parm[: self.p])
              )
              theta[t] = np.dot(self.X[t], parm[-len(self.X_names) :])
          else:
              # Loop over GARCH terms
              for p_term in range(0, self.p):
                  lmda[t] += parm[p_term] * lmda[t - p_term - 1]
  
              # Loop over Score terms
              for q_term in range(0, self.q):
                  lmda[t] += (
                      parm[self.p + q_term] * scores[t - q_term - 1]
                  )
  
              if self.leverage is True:
                  lmda[t] += (
                      parm[-(len(self.X_names) * 2) - 3]
                      * np.sign(-(Y[t - 1] - theta[t - 1]))
                      * (scores[t - 1] + 1)
                  )
  
              lmda[t] += np.dot(
                  self.X[t],
                  parm[-len(self.X_names) * 2 : -len(self.X_names)],
              )
  
              theta[t] = np.dot(
                  self.X[t], parm[-len(self.X_names) :]
              ) + parm[-(len(self.X_names) * 2) - 1] * np.exp(
                  lmda[t] / 2.0
              )
  
          scores[t] = (
              (
                  (parm[self.p + self.q] + 1.0)
                  * np.power(Y[t] - theta[t], 2)
              )
              / float(
                  parm[self.p + self.q] * np.exp(lmda[t])
                  + np.power(Y[t] - theta[t], 2)
              )
          ) - 1.0
  
      return lmda, Y, scores, theta
  
imports: import sys
  import numpy
  import pandas
  import scipy.stats
  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 gas
  from ..None import data_check
label_desc: Use image node_id 3 for calling the EGARCHMReg obj's underlying member method code with example usage: obj._model(beta) and returns: lmda,  Y,  scores,  theta