Skip to content

Commit

Permalink
v__0.195
Browse files Browse the repository at this point in the history
  • Loading branch information
alfredgalichon committed Dec 23, 2024
1 parent 9038265 commit 52cd8b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions mec/blp.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ def pi_invs(pi_t_y,epsilon_t_i_y_m, tau_m, maxit = 100000, reltol=1E-8, require_
dUdtau_t_y_m = - sp.linalg.spsolve(A,B).reshape((T,I+Y,M))[:,-Y:,:]
res.append(dUdtau_t_y_m)



return res


Expand Down Expand Up @@ -117,12 +115,19 @@ def compute_shares(Us_y,epsilons_i_y_m, tau_m):
return pis_y


def compute_utilities(pis_y,epsilons_i_y_m, tau_m):
def compute_utilities(pis_y,epsilons_i_y_m, tau_m, require_der = 0 ):
Us_y = []
for (pi_y,epsilon_i_y_m) in zip(pis_y,epsilons_i_y_m):
U_y = pi_inv(pi_y,epsilon_i_y_m, tau_m )[0].flatten()
if require_der>0:
dUs_y_m = []
for (pi_y,epsilon_i_y_m) in zip(pis_y,epsilons_i_y_m):
res_inversion = pi_inv(pi_y,epsilon_i_y_m, tau_m, require_der = require_der )
U_y = res_inversion[0].flatten()
Us_y.append(U_y)
return Us_y
if require_der>0:
dU_y_m = res_inversion[1]
dUs_y_m.append(dU_y_m)

return [Us_y] if require_der == 0 else [Us_y,dUs_y_m]


def compute_omegas(Us_y,epsilons_i_y_m,depsilonsdp_i_y_m, tau_m,firms_y, require_der = 0):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="mec",
version="0.194",
version="0.195",
authors=["Alfred Galichon"],
author_email="ag133@nyu.edu",
licence="",
Expand Down

0 comments on commit 52cd8b2

Please sign in to comment.