Skip to content

Instantly share code, notes, and snippets.

@trialsolution
trialsolution / non_homothetic_isoquants.plt
Created April 3, 2017 08:56
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"
@trialsolution
trialsolution / bach_martin_2001.gms
Created November 21, 2013 09:41
Numerical example from Bach-Martin (2001): “Would the Right Tariff Aggregator for Policy Analysis Please Stand Up?” Journal of Policy Modeling 23 (6) page 630-632
********************************************************************************
$ontext
CAPRI project
GAMS file : REGAGG.GMS
@purpose :
@author : Mihaly Himics (mihaly.himics@ilr.uni-bonn.de)
@date : 21.11.13
@trialsolution
trialsolution / ces_example.gms
Created November 14, 2013 11:44
Example in Rutherford's Lecture Notes on CES functions, page 4 http://www.gamsworld.eu/mpsge/debreu/ces.pdf
*<%REGION File header%>
*=============================================================================
* File : rutherford_ex1.gms
* Author : mihalyh
* Version : 1.0
* Date : 13.11.2013 10:58:08
* Changed : 13.11.2013 13:13:56
* Changed by: mihalyh
* Remarks :
$ontext
@trialsolution
trialsolution / definite_eigenv.gms
Created August 23, 2013 06:48
checks if a symmetric matrix is pos. definite (GAMS code using the default eigenvalues calculation utility)
$ontext
Test the positive definiteness of a symmetric matrix
Extension of ' eigenexample.gms' from the McCarl User Guide
$offtext
Set index /i1*i3/;
alias(index,index1);
@trialsolution
trialsolution / definite_cholesky.gms
Created August 23, 2013 06:47
checks if a symmetric matrix is pos. definite (GAMS code using the default cholesky decomposition utility)
$ontext
Test the positive definiteness of a symmetric matrix
Extension of the 'choleskyexample.gms' example from the McCarl User Guide
$offtext
Set index /i1*i2/;
@trialsolution
trialsolution / definite.gms
Created August 23, 2013 06:46
checks positive definiteness of a matirx (GAMS and R combined solution)
$ontext
"Is there some GAMS template around to determine the definiteness of a given
matrix? (At the moment, I need it for a 5x5 matrix, but the dimension will
eventually be higher.)
Or is it advisable to switch to another math package for solving this?
Stefan"
@trialsolution
trialsolution / panel_R_link.gms
Created June 3, 2013 08:34
GAMS script that calls the plm package in R to do some panel data econometrics.
$ontext
Email:
"Dear GAMS Users,
Do you have some examples or code files for panel data estimation in GAMS? I was thinking to combine two indices - individual and time, into one index and run OLS, but I could not get any idea of combining two sets into one.
I guess there is some smart way to do panel data estimation.
@trialsolution
trialsolution / freund_1956.gms
Created April 16, 2013 12:27
GAMS implementation of the textbook example for farm planning model Published in Moss "Risk, uncertainty and the agricultural firm", originally from the article of Freund (1956) in Econometrica
$ontext
Freund showed that the expected utility of a normally distributed gamble given
negative exponential preferences could be written as:
E(U(x)) = mu(x) - rho/2 * sigma^2(x)
where mu and sigma are the mean and standard deviation of the normally distributed gamble
@trialsolution
trialsolution / calibrated_share_form.gms
Created March 26, 2013 12:33
A worked example for calibrated CES utility functions; from http://www.mpsge.org/calibration.pdf
*=============================================================================
* File : calibrated_share_form.gms
* Author : mihalyh
* Version : 1.0
* Date : 26.03.2013 12:42:25
* Changed : 26.03.2013 13:22:49
* Changed by: mihalyh
* Remarks :
$ontext
Calibrating CES utility functions