Skip to content

Instantly share code, notes, and snippets.

@trialsolution
Created April 3, 2017 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trialsolution/f80c672508570ec2c900dc465da60152 to your computer and use it in GitHub Desktop.
Save trialsolution/f80c672508570ec2c900dc465da60152 to your computer and use it in GitHub Desktop.
plot indifference curves of non-homothetic CES variants
# plot the indifference curves of non-homothetic CES variants
# script based on the implicit function plotting trick from:
# http://gnuplot-surprising.blogspot.de/2011/09/assume-three-is-equation-fxygxy-and-we.html
# uncomment in case you want to save it to a file
#set term png enhanced lw 2 font "Times,18"
#set output "ces_share.png"
set contour
set cntrparam levels discrete 1
set view map
unset surface
set title "Non-homothetic isoquants (modified CES)"
set xrange [0:5]
set yrange [0:5]
sigma = 2 # elasticity of substitution
rho = 0.5 # 1-(1/sigma)
mu = 0.5 # commitement term
t = 2 # homotheticity parameter (wealth effect)
#
# gradual increase in wealth for the standard CES
# plotted as a set of indifference curves
#
#f(x,y)=(0.5*x**rho + 0.5*y**rho)**(1/rho) # standard CES
#h(x,y)=(0.5*(t*x)**rho + 0.5*(t*y)**rho)**(1/rho) # standard CES doubled consumption
#t1 = 0.5
#g(x,y)=(0.5*(t1*x)**rho + 0.5*(t1*y)**rho)**(1/rho)
#t2 = 1.5
#i(x,y)=(0.5*(t2*x)**rho + 0.5*(t2*y)**rho)**(1/rho)
#
# gradual increase in wealth for the commitment version
# plotted as a set of indifference curves
#
g(x,y)=(0.5*(x-mu)**rho + 0.5*y**rho)**(1/rho) # commitment version
i(x,y)=(0.5*(t*x-mu)**rho + 0.5*(t*y)**rho)**(1/rho) # commitment version
t1 = 0.5
f(x,y)=(0.5*(t1*x-mu)**rho + 0.5*(t1*y)**rho)**(1/rho)
t2 = 1.5
h(x,y)=(0.5*(t2*x-mu)**rho + 0.5*(t2*y)**rho)**(1/rho)
splot f(x,y),g(x,y),h(x,y),i(x,y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment