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, dgp_pbit >>> 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) >>> dgp_pbit(yy)[0:5,:] array([[1], [0], [0], [0], [1]])