class_docstr: data generating process for panel with within correlation
  
  allows various within correlation structures, but no random intercept yet
  
  Parameters
  ----------
  nobs : int
      total number of observations
  k_vars : int
      number of explanatory variables to create in exog, including constant
  n_groups int
      number of groups in balanced sample
  exog : None or ndarray
      default is None, in which case a exog is created
  within : bool
      If True (default), then the exog vary within a group. If False, then
      only variation across groups is used.
      TODO: this option needs more work
  corr_structure : ndarray or ??
      Default is np.eye.
  corr_args : tuple
      arguments for the corr_structure
  scale : float
      scale of noise, standard deviation of normal distribution
  seed : None or int
      If seed is given, then this is used to create the random numbers for
      the sample.
  
  Notes
  -----
  The behavior for panel robust covariance estimators seems to differ by
  a large amount by whether exog have mostly within group or across group
  variation. I do not understand why this should be the case from the theory,
  and this would warrant more investigation.
  
  This is just used in one example so far and needs more usage to see what
  will be useful to add.
class_docstr_tok: ["data","generating","process","for","panel","with","within","correlation","allows","various","within","correlation","structures",",","but","no","random","intercept","yet","Parameters","--","--","--","--","--","nobs",":","int","total","number","of","observations","k_vars",":","int","number","of","explanatory","variables","to","create","in","exog",",","including","constant","n_groups","int","number","of","groups","in","balanced","sample","exog",":","None","or","ndarray","default","is","None",",","in","which","case","a","exog","is","created","within",":","bool","If","True","(","default",")",",","then","the","exog","vary","within","a","group",".","If","False",",","then","only","variation","across","groups","is","used",".","TODO",":","this","option","needs","more","work","corr_structure",":","ndarray","or","?","?","Default","is","np.eye",".","corr_args",":","tuple","arguments","for","the","corr_structure","scale",":","float","scale","of","noise",",","standard","deviation","of","normal","distribution","seed",":","None","or","int","If","seed","is","given",",","then","this","is","used","to","create","the","random","numbers","for","the","sample",".","Notes","--","--","-","The","behavior","for","panel","robust","covariance","estimators","seems","to","differ","by","a","large","amount","by","whether","exog","have","mostly","within","group","or","across","group","variation",".","I","do","not","understand","why","this","should","be","the","case","from","the","theory",",","and","this","would","warrant","more","investigation",".","This","is","just","used","in","one","example","so","far","and","needs","more","usage","to","see","what","will","be","useful","to","add","."]
docstr: generate endog for a random panel dataset with within correlation
docstr_tok: ["generate","endog","for","a","random","panel","dataset","with","within","correlation"]
code: def generate_panel(self):
      """
      generate endog for a random panel dataset with within correlation
  
      """
  
      random = self.random_state
  
      if self.y_true is None:
          self.get_y_true()
  
      nobs_i = self.nobs_i
      n_groups = self.n_groups
  
      use_balanced = True
      if use_balanced:  # much faster for balanced case
          noise = self.random_state.multivariate_normal(
              np.zeros(nobs_i), self.cov, size=n_groups
          ).ravel()
          # need to add self.group_means
          noise += np.repeat(self.group_means, nobs_i)
      else:
          noise = np.empty(self.nobs, np.float64)
          noise.fill(np.nan)
          for ii in range(self.n_groups):
              # print ii,
              idx, idxupp = self.group_indices[ii : ii + 2]
              # print idx, idxupp
              mean_i = self.group_means[ii]
              noise[idx:idxupp] = self.random_state.multivariate_normal(
                  mean_i * np.ones(self.nobs_i), self.cov
              )
  
      endog = self.y_true + noise
      return endog
  
imports: import numpy
  from .None import correlation_structures
label_desc: Use image node_id 3 for calling the PanelSample obj's underlying member method code with example usage: obj.generate_panel() and returns: endog