def get_probit_endog(true_params, exog, noise_level):
 N = exog.shape[0]
 Xdotparams = sp.dot(exog, true_params)
 noise = (noise_level * sp.randn(*Xdotparams.shape))
 cdf = stats.norm._cdf((- Xdotparams))
 endog = sp.zeros(N)
 for i in range(N):
  endog[i] = sp.searchsorted(cdf[i, :], sp.rand())
 return endog

def get_probit_endog ( true_params , exog , noise_level ) : N = exog . shape [ 0 ] Xdotparams = sp . dot ( exog , true_params ) noise = ( noise_level * sp . randn ( * Xdotparams . shape ) ) cdf = stats . norm . _cdf ( ( - Xdotparams ) ) endog = sp . zeros ( N ) for i in range ( N ) : endog [ i ] = sp . searchsorted ( cdf [ i , : ] , sp . rand ( ) ) return endog
gets an endogenous response that is consistent with the true_params .