using Optim
function solve_consumption(r,α,W,A,σ,ψ)
Q = 1/ (1 - 1/(1+r))
f(c) = (Q * c - Q * W^(1 + ψ) * α^ψ * c^(-σ*ψ) - A)^2
r = Optim.optimize(f,0.,A+W)
return r.minimizer
endsolve_consumption (generic function with 1 method)
Consider a dynamic labor supply model (with no uncertainty) where each agent \(n\) chooses a sequence of consumption and hours, \(\{c_{t},h_{t}\}_{t=1}^{\infty}\), to solve: \[ \max \sum_{t=0}^\infty \beta^{t} \left(\frac{c_{t}^{1-\sigma}}{1-\sigma} - \frac{\alpha_{n}^{-1}}{1 + 1/\psi}h_{t}^{1+1/\psi}\right)\] subject to the intertemporal budget constraint: \[ \sum_{t}q_{t}c_{t} \leq A_{n,0} + \sum_{t}q_{t}W_{n,t}h_{t},\qquad q_{t} = (1+r)^{-t}.\] Let \(H_{n,t}\) and \(C_{n,t}\) be the realizations of labor supply for agent \(n\) at time \(t\). Labor supply in this model obeys: \[H_{n,t}^{1/\psi} = (\alpha_{n}W_{n,t})C^{-\sigma}_{n,t}.\] To simplify below, assume that \(\beta=(1+r)^{-1}\), so that the optimal solution features perfectly smoothed consumption, \(C^*_{n}\). Making appropriate substitutions gives \(C^*_{n}\) as the solution to: \[ \left(\sum_{t}q_{t}\right)C^*_{n} = \sum_{t}\left(q_{t}W_{n,t}^{1+\psi}\right)\alpha_{n}^{\psi}(C_{n}^*)^{-\psi\sigma} + A_{n,0}.\]
There is only one object to solve here which is consumption given a sequence of net wages. If one were to assume also constant wages the function below solves optimal consumption.
using Optim
function solve_consumption(r,α,W,A,σ,ψ)
Q = 1/ (1 - 1/(1+r))
f(c) = (Q * c - Q * W^(1 + ψ) * α^ψ * c^(-σ*ψ) - A)^2
r = Optim.optimize(f,0.,A+W)
return r.minimizer
endsolve_consumption (generic function with 1 method)
Here we’ll assume that wages, tastes for work, and assets co-vary systematically. For simplicity we’ll use a multivariate log-normal distribution.
Below is code to simulate a cross-section of 1,000 observations.
using Distributions
function simulate_data(σ,ψ,r,N)
ch = [0.3 0. 0.; 0.5 0.5 0.; 0.4 0.8 1.8]
Σ = ch * ch'
X = rand(MvNormal(Σ),N)
α = exp.(X[1,:])
W = exp.(X[2,:])
A = exp.(X[3,:])
C = [solve_consumption(r,α[i],W[i],A[i],σ,ψ) for i in eachindex(A)]
@views H = exp.( X[1,:] .+ ψ .* X[2,:] .- ψ * σ .* log.(C) )
return (;α,W,A,C,H)
end
# assume risk-aversion of 2 and frisch of 0.5
σ = 2.
ψ = 0.5
r = 0.05
dat = simulate_data(σ,ψ,r,1_000)(α = [0.8325625872008392, 0.9962630352835987, 0.8885806746692435, 1.0925701005945476, 0.979694089236883, 1.0836163138967156, 1.0331845132092115, 1.1752042758339816, 0.8430023365714854, 1.4876767291144681 … 1.1206653578445815, 1.0154072855426861, 0.8549042815472401, 0.8969690930290717, 1.3941648777204114, 0.7912102235012285, 1.0938611999642693, 0.8021512521340305, 1.2176718460396716, 1.8163966968053349], W = [1.1480125466348308, 1.0591778087855994, 0.6141750014717905, 2.4062527204162683, 0.9515391648667579, 1.4694506696800311, 2.163269816911264, 1.1095567931628112, 0.4213294924515321, 1.0757518906453958 … 0.8040407651475204, 1.7064189700818648, 0.7416468930397977, 0.7406881303740364, 0.5986946904751422, 0.2508092368097511, 2.2250003526030175, 0.5224764274006107, 0.9799857092690983, 1.4170755574152123], A = [34.954371964718916, 69.04149024036246, 0.10642255562358229, 6.1457236413797425, 12.091008629864714, 2.7819511555653023, 2.9945446049005966, 0.11309172021659913, 1.478521981687108, 0.5549403123623208 … 6.643346027575894, 10.681885071519977, 0.0031490102527746084, 0.3948753487051468, 0.036458214755153685, 0.21163283761176657, 1.1894745715936748, 0.5266191646516406, 14.53176268100821, 1.4341312243613662], C = [2.1794608123486925, 3.59070273905277, 0.6761250459659739, 2.1269719912185607, 1.288680812562386, 1.4295585579837027, 1.871075038928553, 1.12831249003358, 0.5375369701111443, 1.1798588416729197 … 1.046008602780442, 1.7744901918035187, 0.7447958815305814, 0.7864584756212141, 0.6351528873514529, 0.3393339393423258, 1.8916444375712305, 0.5942598960199967, 1.4369718900802375, 1.5423453879369953], H = [0.40929943369630645, 0.2855479196058828, 1.0299494441046484, 0.7968162077387962, 0.7415807703196826, 0.9188636907426071, 0.8121608078155509, 1.0971316294222433, 1.0179615385119214, 1.3077796563189361 … 0.9606821578909431, 0.7474970915192722, 0.9885048773507075, 0.9815657004947512, 1.6983944589243865, 1.1677136441386682, 0.8625568972206313, 0.9756930100961451, 0.8388645920473728, 1.401927541932])
MaCurdy (1981) and Blundell and Walker (1986) both consider estimation of closely related models of life-cycle labor supply.