OpenSourceEconomics / grmpy

Python package for the simulation and estimation of generalized Roy model
http://grmpy.readthedocs.io
MIT License
19 stars 5 forks source link

SIMULATION after Estimation Flawed #56

Closed peisenha closed 7 years ago

peisenha commented 7 years ago

There is not role for randomenss?

` def simulate_outcomes_estimation(init_dict, X, Z): """The function simulates the outcome Y, the resulting treatment dummy."""

Distribute information

coeffs_untreated = init_dict['UNTREATED']['all']
coeffs_treated = init_dict['TREATED']['all']
coeffs_cost = init_dict['COST']['all']

# Calculate potential outcomes and costs
Y_1 = np.dot(coeffs_treated, X.T)
Y_0 = np.dot(coeffs_untreated, X.T)
C = np.dot(coeffs_cost, Z.T)

# Calculate expected benefit and the resulting treatment dummy
D = np.array((Y_1 - Y_0 - C > 0).astype(int))

# Observed outcomes
Y = D * Y_1 + (1 - D) * Y_0

return Y, D, Y_1, Y_0

`

peisenha commented 7 years ago