Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Continuous margins

    Dear all,

    I am having a quadratic polynomial loss function of the form :
    Click image for larger version

Name:	Screen Shot 2022-03-01 at 17.02.36.png
Views:	1
Size:	9.1 KB
ID:	1652567

    for a macro panel for a larger period of years and for numerous countries with the solid macro variables, dummies, categorical variables and some custom quality indicators, expressed in percentage, which you can see in the data example below for shorter time length and fewer countries.

    where It and Xt are referred to an indicator and the output gap (gdp_hp in the sample data) in period t, respectively, I* is the indicator optimal target, and λ > 0
    is the relative weight on output- gap stabilization. The intertemporal loss function in period t is


    Click image for larger version

Name:	Screen Shot 2022-03-01 at 21.43.01.png
Views:	1
Size:	11.1 KB
ID:	1652569


    I am looking for a code/program that will allow me to find the stochastically optimized value in every year and every country for the indicator1 and its corresponding GDP output in the sample data, generated stochastically those two new variables in my real dataset that are continuous and discrete for the indicator and gdp values separately, for each country and year such that for those values can bring actual GDP close to steady state(potential output), or minimize at most the cyclical component of output estimated with a hp filter.

    Output gap is Xt. : measure of the difference between the actual output and the output it could achieve when at full capacity. Present in the data with hp filter estimation.

    δ, (0 <δ<1), is adiscount factor has also in some way the role of special capital. It is assumed to be high at the beginning of the period, lowering as times passes, reaching to lowest at the end of period. End of persiod is shown with dummy 1


    I have used margins for the panel estimations as whole , but need to estimate each year and country separately by getting the optimal values of the indicator and country in each year and for each country.

    I have seen also the optimization manual , was not able to solve though . Data sample is below:

    I would appreciate any help you can provide
    Thank you in advance

    Best.
    Mario Ferri! .


    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float id int year str48 country double gdp float(indicator1 cpi u industry dummy1 dummy2 dummy3 gdp_cyclical gdp_trend gpd_gain gdp_a)
    1 1990 "Australia"      310777222008.465 -12.242857  7.333022   6.926         . 1 1 1    2639502848  308137721856 .0394041 .28559932
    1 1991 "Australia"       325310415195.04      -14.9  3.176675  9.5792  93713.09 0 0 0   10349180928  314961231872 .3865072 .57119864
    1 1992 "Australia"      324878874105.975      -14.9 1.0122311 10.7288  92812.27 0 0 0    2671803648  322207055872 .7486191   .856798
    1 1993 "Australia"      311544406970.208  -3.484423 1.7536534 10.8738  94994.95 1 1 1  -20409010176  3.319534e+11 .8952165 1.1423973
    1 1994 "Australia"      322211691456.244      -.165 1.9696348  9.7187  96376.65 0 0 0  -24494258176   3.46706e+11 .9484286 1.4279966
    1 1995 "Australia"      367216364716.365      -.165 4.6277666  8.4693  99077.38 0 0 0    1511457536  3.657049e+11 .9702576  1.713596
    1 1996 "Australia"      400302731411.229  18.228453 2.6153846  8.5062  102631.7 1 1 1   16031287296  384271450112 .9804248 1.9991953
    1 1997 "Australia"      434568007512.913     22.593 .22488755  8.3622 104749.55 0 0 0   36599459840  3.979685e+11  .985604 2.2847946
    1 1998 "Australia"      398899138574.239    27.6381  .8601346  7.6756 109901.92 1 0 0   -6025076224  4.049242e+11 .9883389  2.570394
    1 1999 "Australia"      388608221581.652     48.458 1.4831294  6.8723  114295.6 0 0 0  -20514129920  4.091223e+11 .9896897  2.855993
    1 2000 "Australia"      415222633925.768     48.458  4.457435  6.2826 113996.52 0 0 0    1639782144  4.135829e+11  .990099  3.141593
    2 1990 "France"         1269179616913.63      -13.6 3.1942835    9.36         . 0 0 0   12937712640 1.2562419e+12 .0394041 .28559932
    2 1991 "France"         1269276828275.78      -13.6  3.213407  9.1341  57521.93 0 0 0  -34903797760 1.3041807e+12 .3865072 .57119864
    2 1992 "France"         1401465923172.24      -13.6 2.3637605 10.2052  60116.48 0 0 0   47276544000 1.3541894e+12 .7486191   .856798
    2 1993 "France"            1322815612694 -1.6244903 2.1044629 11.3213  59929.35 1 1 1  -79937978368 1.4027536e+12 .8952165 1.1423973
    2 1994 "France"         1393982750472.59   2.136771 1.6555153 12.5928  62658.27 0 0 0  -59940192256  1.453923e+12 .9484286 1.4279966
    2 1995 "France"         1601094756209.75   2.136771 1.7964814 11.8356  63422.89 0 0 0  102137733120  1.498957e+12 .9702576  1.713596
    2 1996 "France"         1605675086549.56   2.136771 1.9828837 12.3673  63864.86 0 0 0   86150086656  1.519525e+12 .9804248 1.9991953
    2 1997 "France"         1452884917959.09 -8.4159155  1.203943 12.5662  64603.23 1 1 1  -60753162240  1.513638e+12  .985604 2.2847946
    2 1998 "France"         1503108739159.44 -16.154552  .6511269 12.0749 66943.195 0 0 0   10017265664 1.4930915e+12 .9883389  2.570394
    2 1999 "France"         1492647560196.04 -16.154552  .5371416 11.9808  68686.82 0 0 0   32687667200   1.45996e+12 .9896897  2.855993
    2 2000 "France"         1362248940482.77 -16.154552   1.67596 10.2172  70390.32 0 0 0  -55671873536 1.4179208e+12  .990099  3.141593
    3 1990 "United Kingdom" 1093169389204.55     30.468  8.063461  6.9736         . 0 0 0   12594491392 1.0805749e+12 .0394041 .28559932
    3 1991 "United Kingdom" 1142797178130.51     30.468  7.461783  8.5521  53880.47 0 0 0   38082850816 1.1047143e+12 .3865072 .57119864
    3 1992 "United Kingdom" 1179659529659.53    28.6106 4.5915494  9.7772  55163.84 1 1 1   48790659072 1.1308689e+12 .7486191   .856798
    3 1993 "United Kingdom" 1061388722255.55       27.9  2.558578 10.3482  57319.64 0 0 0 -105758187520 1.1671469e+12 .8952165 1.1423973
    3 1994 "United Kingdom" 1140489745944.29       27.9 2.2190125  9.6502  62721.02 0 0 0  -88973582336 1.2294634e+12 .9484286 1.4279966
    3 1995 "United Kingdom"    1341584345905       27.9  2.697495  8.6936  63936.54 0 0 0   24772661248 1.3168117e+12 .9702576  1.713596
    3 1996 "United Kingdom" 1415358814352.57       27.9  2.851782  8.1916  64279.65 0 0 0    1409031680   1.41395e+12 .9804248 1.9991953
    3 1997 "United Kingdom" 1559078258022.27  14.663176  2.201143  7.0722  65329.98 1 1 1   49479213056  1.509599e+12  .985604 2.2847946
    3 1998 "United Kingdom" 1650172242464.39      8.072 1.8205616  6.2032  65680.11 0 0 0   5.74659e+10 1.5927063e+12 .9883389  2.570394
    3 1999 "United Kingdom" 1682399288141.08      8.072 1.7529508  6.0429  67823.23 0 0 0   22264080384  1.660135e+12 .9896897  2.855993
    3 2000 "United Kingdom" 1657816613708.58      8.072 1.1829562  5.5616  69648.87 0 0 0  -60127121408 1.7179438e+12  .990099  3.141593
    4 1990 "United States"      5.963144e+12       29.4  5.397956     5.6         . 1 0 0   84337139712  5.878807e+12 .0394041 .28559932
    4 1991 "United States"      6.158129e+12       29.4  4.234964     6.8         . 0 0 0  -39289442304  6.197419e+12 .3865072 .57119864
    4 1992 "United States"      6.520327e+12       29.4 3.0288196     7.5         . 1 0 0   -9196966912  6.529524e+12 .7486191   .856798
    4 1993 "United States"      6.858559e+12  13.382143  2.951657     6.9         . 0 0 0  -23772067840  6.882331e+12 .8952165 1.1423973
    4 1994 "United States"      7.287236e+12       12.5  2.607442  6.1187         . 1 0 0   25660139520  7.261576e+12 .9484286 1.4279966
    4 1995 "United States"      7.639749e+12       12.5   2.80542  5.6504         . 0 0 0  -29441933312  7.669191e+12 .9702576  1.713596
    4 1996 "United States"      8.073122e+12       12.5  2.931204  5.4511         . 1 0 0  -38092492800  8.111215e+12 .9804248 1.9991953
    4 1997 "United States"     8577554463000   8.977967 2.3376899  5.0003  74095.41 0 0 0  -11419578368  8.588974e+12  .985604 2.2847946
    4 1998 "United States"     9062818211000      8.784  1.552279  4.5105  75984.69 1 0 0  -34884067328  9.097702e+12 .9883389  2.570394
    4 1999 "United States"     9630664202000      8.784 2.1880271  4.2188  79374.63 0 0 0    -140565792  9.630805e+12 .9896897  2.855993
    4 2000 "United States"    10252345464000      8.784  3.376857   3.992  81904.71 1 0 0   76239831040 1.0176106e+13  .990099  3.141593
    end
    format %ty year
    Attached Files

  • #2
    To follow up,
    How can I write in stata equational form the first and second equation?

    Also, the intertemporal loss function approaches the weighted sum of the unconditional variances of I and the output gap, xt . When the unconditional means of inflation and the output gap equal the indicator target and zero, respectively: Eit] = I* and E[xt] = 0.
    Since this condition does not allow derivatives with respect to indocaator I and output gap,xt in a particular (future) period, such derivatives must be computed before the limit is calculated.

    Comment

    Working...
    X