# Perfect foresight simulation with initial values off steady state

**URL:** <https://forum.dynare.org/t/perfect-foresight-simulation-with-initial-values-off-steady-state/27527>\
**Category:** Perfect foresight simulations\
**Created:** [2 May 2025 17:10 UTC](https://forum.dynare.org/t/perfect-foresight-simulation-with-initial-values-off-steady-state/27527 "2025-05-02T17:10:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Argyn](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Argyn](https://forum.dynare.org/u/Argyn)\
**Post date:** [2 May 2025 17:10 UTC](https://forum.dynare.org/t/perfect-foresight-simulation-with-initial-values-off-steady-state/27527/1 "2025-05-02T17:10:18Z")

</div>

Hello everyone,

I am trying to simulate the Ramsey-Cass-Koopmans model (deterministic) starting from initial values that off the steady state to see a path of convergence. However, I am getting the paths for k and c with all their values at their steady states (k,c)=(1.7378,0.9186). How to fix that (chatGPTs suggestions didn’t work so far)?  
In addition, what is the correct way to specify the equation for capital: as a forward looking k(+1) = (1/GL\_tilda)\*((1-delta)_k+k^alpha-c); or a backward looking k = (1/GL\_tilda)_((1-delta)\*k(-1)+k(-1)^alpha-c);? Both cases produce the same result.

Thank you.

Argyn

Here is the mod-file:

```auto
var GL_tilda, k, c;

parameters gga, ggl, delta, theta, alpha, beta;
    gga = 1.03; % gross growth rate of productivity
    ggl = 1.02; % gross growth rate of population
    delta = 0.1; % depreciation rate 
    theta = 3; % coefficient of CRRA
    alpha = 0.3; % income share of capital
    beta = 0.99; % what is the value for beta to match ? 4% growth rate

steady_state_model;
    GL_tilda = gga*ggl;
    k = ((gga^theta/beta - 1 + delta)/alpha)^(1/(alpha-1));
    c = (1-delta)*k+k^alpha-GL_tilda*k;
end;

steady;
check;
model_diagnostics;

model;
    % Assume F(K, L_tilda) = K^alpha*(A*L)^(1-alpha) => f(k) = k^alpha
    % kstar = (((1+ga)^theta/beta - 1 + delta)/alpha)^(1/(alpha-1));
    GL_tilda = gga*ggl;
        
    k(+1) = (1/GL_tilda)*((1-delta)*k+k^alpha-c);
    % k = (1/GL_tilda)*((1-delta)*k(-1)+k(-1)^alpha-c);                              
    c(+1) = (1/gga)*beta^(1/theta)*(1-delta+alpha*k^(alpha-1))^(1/theta)*c;   
    
end;

initval;
    % NE quadrant
    k = 5;
    c = 2;
end;

perfect_foresight_setup(periods=50);
perfect_foresight_solver;

rplot k, c;

```

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [4 May 2025 14:40 UTC](https://forum.dynare.org/t/perfect-foresight-simulation-with-initial-values-off-steady-state/27527/2 "2025-05-04T14:40:44Z")

</div>

Try [rck.mod](https://forum.dynare.org/uploads/short-url/lCmQSVtXetntl4DbTW8UY5tIAkl.mod) (1.2 KB)  
It has the correct timing and the correct initial and terminal condition setup.

---

<div class="post-metadata">

**Author:** ![Argyn](https://forum.dynare.org/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@Argyn](https://forum.dynare.org/u/Argyn)\
**Post date:** [5 May 2025 20:57 UTC](https://forum.dynare.org/t/perfect-foresight-simulation-with-initial-values-off-steady-state/27527/3 "2025-05-05T20:57:30Z")

</div>

> [@jpfeifer](#):
>
> It has the correct timing and the correct initial and terminal condition setup.

Professor Pfeifer thank you.  
It works.  
Is there a link to better understand why did those changes?

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://forum.dynare.org/user_avatar/forum.dynare.org/jpfeifer/32/5044_2.png) [@jpfeifer](https://forum.dynare.org/u/jpfeifer)\
**Post date:** [6 May 2025 05:53 UTC](https://forum.dynare.org/t/perfect-foresight-simulation-with-initial-values-off-steady-state/27527/4 "2025-05-06T05:53:21Z")

</div>

1. Proper perfect foresight simulations regularly require a terminal condition typically set with `endval`. That is for example documented in the manual.
2. The timing convention for predetermined states is also documented in the manual.

The slides at [deterministic.pdf · master · Sébastien Villemot / perfect-foresight-slides · GitLab](https://git.dynare.org/sebastien/perfect-foresight-slides/-/blob/master/deterministic.pdf?ref_type=heads) may also be helpful.
