STO5 Storage-trade model of a small country

Model's structure

Response variables Storage ($S$), Price ($P$), Import ($M$) and Export ($X$).

State variable Availability ($A$) and World price ($P^{w}$).

Shock Production shocks ($\epsilon$) and Innovation on world price ($\nu$).

Parameters Unit physical storage cost ($k$), Interest rate ($r$), Demand price elasticity ($\alpha$), World price autocorrelation ($\rho$), Trade cost ($\theta$) and Standard deviation of innovation on world price ($\sigma$).

Equilibrium equations

$$S_{t}: S_{t}\ge 0 \quad \perp \quad P_{t}+k-\frac{\mathrm{E}_{t}\left(P_{t+1}\right)}{1+r}\ge 0,$$

$$P_{t}: P_{t}\ge 0 \quad \perp \quad A_{t}+M_t-{P_{t}}^{\alpha}-S_{t}-X_t\ge 0,$$

$$M_{t}: M_{t}\ge 0 \quad \perp \quad P^w_{t}+\theta\ge P_{t},$$

$$X_{t}: X_{t}\ge 0 \quad \perp \quad P_{t}\ge P^w_{t}-\theta.$$

Transition equation

$$A_{t}: A_{t}=S_{t-1}+\epsilon_{t},$$

$$P^w_{t}: P^w_{t} = {P^w_{t-1}}^{\rho} e^{\sigma\nu_{t}}.$$

Writing the model

The model is defined in a Yaml file: sto5.yaml.

Create the model object

Mu                = [1 0];
sigma             = [0.05 0;
                     0    1];
model = recsmodel('sto5.yaml',struct('Mu',Mu,'Sigma',sigma^2,'order',7));
Deterministic steady state (equal to first guess)
 State variables:
		1	1	

 Response variables:
		0	1	0	0	

 Expectations variables:
		1	

Define approximation space

Minimum and maximum values of the state variable grid

smin          = [min(model.e(:,1))*0.95; 0.4 ];
smax          = [1.6;                    2.12];

Interpolation structure

[interp,s]    = recsinterpinit(25,smin,smax);

Find a first guess through the perfect foresight solution

interp = recsFirstGuess(interp,model,s,model.sss,model.xss,struct('T',5));

Solve for rational expectations

[interp,x] = recsSolveREE(interp,model,s);
Successive approximation
  Major	 Minor	Residual
      0	     0	4.60E-01 (Input point)
      1	     1	1.38E-01
      2	     1	9.55E-02
      3	     1	6.08E-02
      4	     1	3.33E-02
      5	     1	1.64E-02
      6	     1	7.56E-03
      7	     1	3.21E-03
      8	     1	1.31E-03
      9	     1	5.12E-04
     10	     1	1.96E-04
     11	     1	7.36E-05
     12	     1	2.74E-05
     13	     1	1.01E-05
     14	     1	3.73E-06
     15	     1	1.37E-06
     16	     1	5.05E-07
     17	     1	1.84E-07
     18	     1	0.00E+00
Solution found - Residual lower than absolute tolerance

Simulate the model

options = struct('simulmethod','solve'       ,...
                 'stat'       ,1);
recsSimul(model,interp,repmat([1 1],10,1),200,[],options);
subplot(2,3,1)
xlabel('Availability')
ylabel('Frequency')
subplot(2,3,2)
xlabel('World price')
ylabel('Frequency')
subplot(2,3,3)
xlabel('Storage')
ylabel('Frequency')
subplot(2,3,4)
xlabel('Price')
ylabel('Frequency')
subplot(2,3,5)
xlabel('Import')
ylabel('Frequency')
subplot(2,3,6)
xlabel('Export')
ylabel('Frequency')
Warning: Extrapolating beyond smax 
Statistics from simulated variables (excluding the first 20 observations):
 Moments
    Mean      Std. Dev. Skewness  Kurtosis  Min       Max       %LB       %UB
    1.0121    0.0524    0.2533    3.2554    0.8569    1.2061
    1.0255    0.2120    0.7729    4.3732    0.4793    2.2492

  Columns 1 through 7

    0.0104    0.0192    2.3129    8.9467         0    0.1361   60.2778
    1.0202    0.1614    1.1930    5.2446    0.6793    2.0492         0
    0.0070    0.0189    3.5235   18.0409         0    0.1905   77.1667
    0.0099    0.0270    3.5304   17.3145         0    0.2177   79.7778

  Column 8

         0
         0
         0
         0

 Correlation
    1.0000   -0.0548    0.7136   -0.6221   -0.5051    0.3628
   -0.0548    1.0000   -0.2081    0.7003   -0.3347    0.5617
    0.7136   -0.2081    1.0000   -0.5577   -0.1512   -0.1104
   -0.6221    0.7003   -0.5577    1.0000    0.0300    0.2944
   -0.5051   -0.3347   -0.1512    0.0300    1.0000   -0.1357
    0.3628    0.5617   -0.1104    0.2944   -0.1357    1.0000

 Autocorrelation
    1         2         3         4         5
    0.2706    0.0388    0.0086   -0.0045    0.0274
    0.5730    0.3406    0.2013    0.1292    0.0545

    0.3465    0.0940    0.0195   -0.0117    0.0352
    0.3704    0.1861    0.1272    0.0766    0.0550
    0.1108    0.0632    0.0458   -0.0428   -0.0107
    0.1939    0.0903    0.0510    0.0573    0.0225