spreg.dgp.make_bin

spreg.dgp.make_bin(yy)[source]
make_bin: generates y as 0-1 variable for y > mean of y,

i.e., for discrete dependent variables

Examples

>>> import numpy as np
>>> import libpysal
>>> from spreg import make_x, dgp_ols, make_bin
>>> rng = np.random.default_rng(12345)
>>> u = make_x(rng,25,mu=[0],varu=[1], method='normal')
>>> x = make_x(rng,25,mu=[0],varu=[1])
>>> xb = make_xb(x,[1,2])
>>> yy = dgp_ols(u,xb)
>>> make_bin(yy)[0:5,:]
array([[1],
       [0],
       [0],
       [0],
       [1]])