def plot_ccpr_grid(results, exog_idx=None, grid=None, fig=None):
 fig = utils.create_mpl_fig(fig)
 (exog_name, exog_idx) = utils.maybe_name_or_idx(exog_idx, results.model)
 if (grid is not None):
  (nrows, ncols) = grid
 elif (len(exog_idx) > 2):
  nrows = int(np.ceil((len(exog_idx) / 2.0)))
  ncols = 2
 else:
  nrows = len(exog_idx)
  ncols = 1
 seen_constant = 0
 for (i, idx) in enumerate(exog_idx):
  if (results.model.exog[:, idx].var() == 0):
   seen_constant = 1
   continue
  ax = fig.add_subplot(nrows, ncols, ((i + 1) - seen_constant))
  fig = plot_ccpr(results, exog_idx=idx, ax=ax)
  ax.set_title('')
 fig.suptitle('Component-Component Plus Residual Plot', fontsize='large')
 fig.tight_layout()
 fig.subplots_adjust(top=0.95)
 return fig

def plot_ccpr_grid ( results , exog_idx = None , grid = None , fig = None ) : fig = utils . create_mpl_fig ( fig ) ( exog_name , exog_idx ) = utils . maybe_name_or_idx ( exog_idx , results . model ) if ( grid is not None ) : ( nrows , ncols ) = grid elif ( len ( exog_idx ) > 2 ) : nrows = int ( np . ceil ( ( len ( exog_idx ) / 2.0 ) ) ) ncols = 2 else : nrows = len ( exog_idx ) ncols = 1 seen_constant = 0 for ( i , idx ) in enumerate ( exog_idx ) : if ( results . model . exog [ : , idx ] . var ( ) == 0 ) : seen_constant = 1 continue ax = fig . add_subplot ( nrows , ncols , ( ( i + 1 ) - seen_constant ) ) fig = plot_ccpr ( results , exog_idx = idx , ax = ax ) ax . set_title ( '' ) fig . suptitle ( 'Component-Component Plus Residual Plot' , fontsize = 'large' ) fig . tight_layout ( ) fig . subplots_adjust ( top = 0.95 ) return fig
generate ccpr plots against a set of regressors .