SPB Git

spb/wp25_uqo

Public
5.4 KB · 91 lines python
1"""Symbolic derivation of the linear-quadratic delegation game (Model A core).23Agents i in [0,1] choose an action x_i (log-deviation of next-period capital holdings4from the full-information steady state).  Quadratic payoff56    U(x_i, X, theta) = U_xx x_i^2/2 + U_xX x_i X + U_XX X^2/2 + U_xt x_i theta + U_Xt X theta (+ terms without x)78normalized by |U_xx|:  best response  x_i = E_i[ k0 * theta + alpha * X ],9    k0 = -U_xt/U_xx,  alpha = -U_xX/U_xx  (alpha<0: strategic substitutes, as in capital accumulation).1011Information:  theta ~ N(0, 1/tau_t).  Non-delegators (mass 1-D) see s_i = theta + e_i, e_i ~ N(0, 1/tau_H), iid.12Delegators (mass D, split evenly across M foundation models) see s_m = theta + eta_m, eta_m ~ N(0, 1/tau_A) iid across m,13*common* to all users of model m.1415This script derives (and prints as LaTeX-ready expressions):16  1. equilibrium linear strategies a_H, a_A and aggregate X = Abar*theta + (D a_A / M) sum_m eta_m;17  2. aggregate "model-noise" variance and the aggregate tracking error;18  3. welfare decomposition (Angeletos-Pavan 2007):  W = W* - (1/2)|U_xx|[ (1-alpha_soc) E(X-X*)^2 + E(x_i-X)^2 ] - fees19     where the social curvature is (U_xx+2U_xX+U_XX)/U_xx; under the CRS/pecuniary restriction U_xX+U_XX=0 it equals (1-alpha);20  4. private value of delegation for a measure-zero agent vs. the social marginal value dW/dD -> the delegation wedge.21All results are numerically cross-checked in tests/unit/test_lq_game.py.22"""23import sympy as sp2425D, M, alpha, k0 = sp.symbols('D M alpha kappa_0', real=True)26tau_t, tau_H, tau_A = sp.symbols('tau_theta tau_H tau_A', positive=True)27bH = tau_H/(tau_t+tau_H)          # Bayesian weight, human signal28bA = tau_A/(tau_t+tau_A)          # Bayesian weight, AI signal29sig_t2, sig_H2, sig_A2 = 1/tau_t, 1/tau_H, 1/tau_A3031# ---- 1. Equilibrium strategies -------------------------------------------------32# Non-delegator: x_i = k0 E_i theta + alpha E_i X ;  E_i eta_m = 0  ->  a_H = (k0 + alpha*Abar) bH33# Delegator m:   E_m X = Abar E_m theta + (D a_A/M) E_m eta_m ,  E_m theta = bA s_m , E_m eta_m = (1-bA) s_m34#                -> a_A = bA (k0+alpha Abar) + alpha (D/M)(1-bA) a_A35c = sp.symbols('c')                        # c = k0 + alpha*Abar36xi = 1/(1 - alpha*(D/M)*(1-bA))            # delegator damping factor (xi<1 if alpha<0)37aH = bH*c38aA = bA*c*xi39Abar = (1-D)*aH + D*aA40c_sol = sp.solve(sp.Eq(c, k0 + alpha*Abar), c)[0]41aH, aA, Abar = [sp.simplify(e.subs(c, c_sol)) for e in (aH, aA, Abar)]42kappa_full = k0/(1-alpha)                  # full-information equilibrium response X* = kappa_full*theta4344# ---- 2. Aggregate law of motion ----------------------------------------------------45# X = Abar*theta + (D*aA/M) * sum_m eta_m   ->  Var(model noise) = D^2 aA^2 sig_A2 / M46V_noise = D**2*aA**2*sig_A2/M47V_track = (Abar-kappa_full)**2*sig_t248V_agg = V_track + V_noise                  # E (X - X*)^24950# ---- 3. Dispersion  E (x_i - X)^2 --------------------------------------------------51# non-delegator: x_i - X = aH e_i + (aH-Abar) theta - (D aA/M) sum eta52# delegator m  : x_i - X = aA eta_m - (D aA/M) sum eta + (aA-Abar) theta53V_disp_H = aH**2*sig_H2 + (aH-Abar)**2*sig_t2 + V_noise54V_disp_A = (aA-Abar)**2*sig_t2 + sp.expand((aA*sig_A2)*(aA) - 2*aA*(D*aA/M)*sig_A2 + V_noise)  # Var(aA eta_m - (D aA/M) sum eta)55V_disp = (1-D)*V_disp_H + D*V_disp_A5657# ---- 4. Welfare and the delegation wedge --------------------------------------------58# Social curvature ratio (U_xx+2U_xX+U_XX)/U_xx = 1 - 2*alpha + U_XX/U_xx ; with U_XX = -U_xX (CRS) -> 1 - alpha.59phi = sp.symbols('phi', positive=True)     # fee + disutility, in units of |U_xx|/260alpha_soc = 1-alpha61W = -(sp.Rational(1,2))*(alpha_soc*V_agg + V_disp) - D*phi   # per-capita welfare relative to full information (|U_xx| normalised to 1)6263# Private value of delegation for a measure-zero agent: target  x^ = k0 theta + alpha X.64# Loss = (1/2) Var(x^ | own signal).  For a non-delegator: Var(k0 theta + alpha X | s_i).65# For a delegator of model m: Var(k0 theta + alpha X | s_m).66# X = Abar theta + (D aA/M) sum_m eta_m.  Let g = k0 + alpha*Abar.  x^ = g theta + alpha (D aA/M) sum eta.67g = k0 + alpha*Abar68# Var(x^) = g^2 sig_t2 + alpha^2 (D aA/M)^2 M sig_A269Vx = g**2*sig_t2 + alpha**2*(D*aA/M)**2*M*sig_A270# human: Cov(x^, s_i) = g sig_t2 ; Var(s_i) = sig_t2 + sig_H271PV_H_loss = sp.simplify(Vx - (g*sig_t2)**2/(sig_t2+sig_H2))72# AI model m: Cov(x^, s_m) = g sig_t2 + alpha (D aA/M) sig_A2 ; Var(s_m) = sig_t2 + sig_A273PV_A_loss = sp.simplify(Vx - (g*sig_t2 + alpha*(D*aA/M)*sig_A2)**2/(sig_t2+sig_A2))74private_value = sp.simplify(sp.Rational(1,2)*(PV_H_loss - PV_A_loss))     # gain in units |U_xx|75social_mv = sp.simplify(sp.diff(W, D) + phi)                               # d(W + D phi)/dD : gross social marginal value76wedge = sp.simplify(private_value - social_mv)                              # >0 : competitive over-delegation7778if __name__ == '__main__':79    sp.init_printing()80    print('a_H =', sp.simplify(aH)); print('a_A =', sp.simplify(aA)); print('Abar =', sp.simplify(Abar))81    print('V_noise =', V_noise)82    print('private value =', private_value)83    print('social marginal value (gross) =', social_mv)84    print('wedge =', wedge)85    # No-strategic-interaction limit alpha -> 086    print('wedge | alpha=0 :', sp.simplify(wedge.subs(alpha, 0)))87    print('private | alpha=0 :', sp.simplify(private_value.subs(alpha, 0)))88    print('social  | alpha=0 :', sp.simplify(social_mv.subs(alpha, 0)))89    # Series of wedge in D around 090    print('wedge series in D:', sp.series(wedge, D, 0, 2))91
Files · 3eb268136bd01728eb84cccbf3a186d6c7a648c1
Menu

Theme