def _margeff_cov_params_dummy(model, cov_margins, params, exog, dummy_ind, method, J):
 for i in dummy_ind:
  exog0 = exog.copy()
  exog1 = exog.copy()
  exog0[:, i] = 0
  exog1[:, i] = 1
  dfdb0 = model._derivative_predict(params, exog0, method)
  dfdb1 = model._derivative_predict(params, exog1, method)
  dfdb = (dfdb1 - dfdb0)
  if (dfdb.ndim >= 2):
   dfdb = dfdb.mean(0)
  if (J > 1):
   K = (dfdb.shape[1] // (J - 1))
   cov_margins[i::K, :] = dfdb
  else:
   cov_margins[i, :] = dfdb
 return cov_margins

def _margeff_cov_params_dummy ( model , cov_margins , params , exog , dummy_ind , method , J ) : for i in dummy_ind : exog0 = exog . copy ( ) exog1 = exog . copy ( ) exog0 [ : , i ] = 0 exog1 [ : , i ] = 1 dfdb0 = model . _derivative_predict ( params , exog0 , method ) dfdb1 = model . _derivative_predict ( params , exog1 , method ) dfdb = ( dfdb1 - dfdb0 ) if ( dfdb . ndim >= 2 ) : dfdb = dfdb . mean ( 0 ) if ( J > 1 ) : K = ( dfdb . shape [ 1 ] // ( J - 1 ) ) cov_margins [ i : : K , : ] = dfdb else : cov_margins [ i , : ] = dfdb return cov_margins
returns the jacobian for discrete regressors for use in margeff_cov_params .