Linking STATA and GAMS
Uwe A. Schneider
last updated January 2010
Other GAMS interfaces from/to: ShadeMap Gnuplot Stata Powerpoint Html Awk
Use the option outreg in STATA to create a text file which contains the regression coefficients. For example:
xtgls
PAha ltemp_season lprecipitation_annual lmrevenue if pestF==3
& cropgr==1
mfx
outreg using "stata_CrT1_loglog.txt", se bracket
nolabel ctitle(pestF3) append
With the option outreg, the STATA output file will look like this:
(1) (2)
(3) (4)
(5) (6)
(7) (8)
(9) (10) (11)
(12)
pestF2 pestF3
pestF5 pestF6 pestF7 pestF8 pestF9 pestF10 pestF16
pestF17 pestF18 pestF20
ltemp_season_C -0.000 0.226
-0.001 0.025 -10.117 0.051 -0.091
5.582 0.005 -0.068
-0.088
[0.002] [0.147] [0.001]
[0.037] [11.823] [0.203]
[0.017]** [3.240] [0.011]
[0.029]*
lprecipitation_annual_mm
-0.001 -0.007 -0.000 0.003 4.250
-0.022 0.062 0.290
-0.002
[0.000] [0.019] [0.000]
[0.004] [4.358] [0.022] [0.008]** [0.311]
[0.004] [0.003] [0.009]
lmrevenue
0.000 0.018 -0.000 0.002
5.724 -0.084 0.014 1.025 -0.001
0.005 -0.004
[0.001]
[0.018] [0.000] [0.003] [3.913] [0.018]**
[0.002]**
[0.338]**
[0.001]
ltotal_area 0.003
0.016 -0.000 -0.003 3.192 -0.051
-0.104 0.402 -0.000 -0.003
-0.007
[0.001]** [0.013] [0.000] [0.002] [2.639]
[0.016]**
[0.014]** [0.217]
[0.002]
lprecipM -0.002
0.047 -0.000 -0.002 9.290 -0.072
0.417 0.407 0.004 -0.001
0.036
[0.001]* [0.029] [0.000] [0.007]
[13.858] [0.038]
[0.054]** [0.568]
[0.006]
lTempavr
-0.610 0.005 -0.069 -4.132 0.513
-1.672 -19.465 -0.029 0.103
0.573
[0.252]* [0.003] [0.065]
[12.819] [0.407]
[0.224]**
[5.936]**
Constant -0.012
1.572 -0.014 0.234 -58.319 -1.065
6.117 53.775 0.106 -0.193
-2.040
[0.009]
[0.678]*
[0.007]* [0.174]
[71.403] [1.172]
[0.818]**
[15.926]
Observations 9
52 14
102 10
56 8
67 32
64 24
Number of
cropyear 5
13 8
15 5
15 8
15 11 14
Standard
errors in brackets
* significant at 5%; ** significant at 1%
An example is here. The translated regression data in GAMS format look as below:
Table
CrT1_loglog_RegrData(RegressionCoefficients,RegressionItem,Chemical_FamilyCode)
pestF2 pestF3
pestF5
pestF6
ltemp_season_C
.Coefficient
0 0.226
-0.001
0.025
ltemp_season_C .StandardDev
0.002
0.147
0.001
0.037
ltemp_season_C
.SignifLevel
0
0
0
0
lprecipitation_annual_mm
.Coefficient -0.001
-0.007
0
0.003
lprecipitation_annual_mm
.StandardDev
0
0.019
0
0.004
lprecipitation_annual_mm
.SignifLevel
0
0
0
0
lmrevenue
.Coefficient
0
0.018
0
0.002
lmrevenue .StandardDev
0.001
0.018
0
0.003
lmrevenue
.SignifLevel
0
0
0
0
Constant .Coefficient
-0.012 1.572
-0.014
0.234
Constant .StandardDev
0.009
0.678
0.007
0.174
Constant
.SignifLevel
0
5
5
0
;
Download complete example