@@ -383,7 +383,9 @@ def sw_weights(self):
383383 + ((self .theta_z * self .eti * self .mtr ) / (1 - self .mtr ))
384384 + ((self .eti * self .z * self .mtr_prime ) / (1 - self .mtr ) ** 2 )
385385 )
386- integral = np .trapz (g_z * self .f , self .z ) # renormalize to integrate to 1
386+ integral = np .trapz (
387+ g_z * self .f , self .z
388+ ) # renormalize to integrate to 1
387389 g_z = g_z / integral
388390
389391 # use Lockwood and Weinzierl formula, which should be equivalent but using numerical differentiation
@@ -402,7 +404,7 @@ def sw_weights(self):
402404 return g_z , g_z_numerical
403405
404406
405- def find_eti (iot , g_z = None , eti_0 = 0.25 ):
407+ def find_eti (iot , g_z = None , eti_0 = 0.25 ):
406408 """
407409 This function solves for the ETI that would result in the
408410 policy represented via MTRs in IOT being consistent with the
@@ -420,12 +422,16 @@ def find_eti(iot, g_z = None, eti_0 = 0.25):
420422 Returns:
421423 eti_beliefs (array-like): vector of ETI beliefs over z
422424 """
423-
425+
424426 if g_z is None :
425427 g_z = iot .g_z
426-
428+
427429 # we solve an ODE of the form f'(z) + P(z)f(z) = Q(z)
428- P_z = 1 / iot .z + iot .f_prime / iot .f + iot .mtr_prime / (iot .mtr * (1 - iot .mtr ))
430+ P_z = (
431+ 1 / iot .z
432+ + iot .f_prime / iot .f
433+ + iot .mtr_prime / (iot .mtr * (1 - iot .mtr ))
434+ )
429435 # integrating factor for ODE: mu(z) * f'(z) + mu(z) * P(z) * f(z) = mu(z) * Q(z)
430436 mu_z = np .exp (np .cumsum (P_z ))
431437 Q_z = (g_z - 1 ) * (1 - iot .mtr ) / (iot .mtr * iot .z )
0 commit comments