Skip to content

Instantly share code, notes, and snippets.

@trialsolution
trialsolution / salhofer1996.gms
Created February 10, 2014 18:56
Finding efficient policy combinations in an optimization framework, aka Salhofer (1996)
* GAMS code based on the bread grain market model in
* Salhofer (1996), “Efficient Income Redistribution for a Small Country Using Optimal Combined Instruments.”
* Salhofer, K. 1996. “Efficient Income Redistribution for a Small Country Using Optimal Combined Instruments.” Agricultural Economics 13 (3): 191–99. doi:10.1016/0169-5150(95)01162-5.
* The code builds on Salhofer's GAMS example provided in the course "Welfare Economics"
* General idea of the optimization model:
* Maximizes consumers/taxpayers surplus s.t. a given support level and four policy instruments
@trialsolution
trialsolution / chap5_gt.gms
Last active August 29, 2015 14:02
Exercise to chapter five of Gilbert and Tower: Introduction to Numerical Simulation for Trade Theory and Policy
*
*
* This file is an extension of
* the long-run production problem, as described in Chapter 5 of
* Gilbert and Tower: Introduction to Numerical Simulation for Trade Theory and Policy.
*
* for download of the original model go to
* http://ideas.repec.org/c/uth/gt2013/2012-03.html
*
@trialsolution
trialsolution / nonzero_trade.gms
Created June 3, 2014 10:18
Calibrate the small country HOS model to nonzero trade (Chapter 12, exercise 3 in Gilbert-Tower book)
*
* --- Small country trading equilibrium
*
* Reasons for trade in the single country HO model
* Differences in good and factor prices and factor intensities
*
*
@trialsolution
trialsolution / draw_PPF.gms
Last active August 29, 2015 14:02
Howto draw a PPF using the GUSS solver option in GAMS
*
* Howto draw a PPF using the GUSS solver option in GAMS
*
* This file is an extension of
* the long-run production problem, as described in Chapter 5 of
* Gilbert and Tower: Introduction to Numerical Simulation for Trade Theory and Policy.
*
* for download of the original model go to
* http://ideas.repec.org/c/uth/gt2013/2012-03.html
*
@trialsolution
trialsolution / ces_shares.plt
Created October 1, 2014 10:13
CES indifference curves with different value shares
#
# GNUPLOT script to draw CES functions with different parameters
#
# 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"
@trialsolution
trialsolution / ces_elas.plt
Created October 1, 2014 10:14
CES indifference curves with different elasticities
#
# GNUPLOT script to draw CES functions with different parameters
#
# 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_elas.png"
@trialsolution
trialsolution / polar_rose.R
Created January 1, 2011 16:55
drawing "polar roses" curves in polar coordinate system
require(ggplot2)
#data points
p <- data.frame(t=seq(-2*pi, 2*pi, 0.1))
#1.. drawing polar rose
c <- ggplot(p, aes(x=t, y=cos(3*t)))
c + geom_line() + coord_polar()
#2.. another one with sine
@trialsolution
trialsolution / hos_small_open.gms
Created May 31, 2014 15:21
2x2 HOS model for a small open economy
*
* --- Small country trading equilibrium
*
* Different variants of the same model:
*
*
* (1) explicit trade balance condition [import value = export value] or 'nested' budget constraint [max. income = production value]
@trialsolution
trialsolution / ev.gms
Created October 31, 2012 11:59
EV frontier analysis for a simple farm management problem
$ontext
PROBLEM STATMENT
EV analysis from Hazell-Norton
AIM: draw the EV-frontier for the following farm planning problem
MODEL 1. EXPECTED PROFIT MAXIMIZATION (farm with fixed land, 4 crops, fixed labour and a rotational constraint)
@trialsolution
trialsolution / ev2.gms
Created November 2, 2012 12:19
utility maximization on the EV frontier
$ontext
PROBLEM STATMENT
EV analysis from Hazell-Norton
ctnd. from ev.gms
Extension: find the optimal farm decision based on EUH; having the EV-frontier and assuming a utility function