# Dsample command

**URL:** <https://forum.dynare.org/t/dsample-command/955>\
**Category:** Perfect foresight simulations\
**Created:** [8 March 2009 15:59 UTC](https://forum.dynare.org/t/dsample-command/955 "2009-03-08T15:59:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![monetarist](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@monetarist](https://forum.dynare.org/u/monetarist)\
**Post date:** [8 March 2009 15:59 UTC](https://forum.dynare.org/t/dsample-command/955/1 "2009-03-08T15:59:16Z")

</div>

Dear all,

I have a little problem with dsample.

E.g. if I use it like:

// Adapted from Jesus Fernandez-Villaverde, Basic RBC Model with Monopolistic Competion Philadelphia, March 3, 2005

var y c k i l w r;  
varexo z;  
parameters beta psi delta alpha sigma epsilon;

alpha = 0.33;  
beta = 0.99;  
delta = 0.023;  
psi = 1.75;  
sigma = (0.007/(1-alpha));  
epsilon = 10;

model;  
(1/c) = beta\*(1/c(+1))_(1+r(+1)-delta);  
psi_c/(1-l) = w;  
c+i = y;  
y = (k(-1)^alpha)_(exp(z)l)^(1-alpha);  
w = y((epsilon-1)/epsilon)_(1-alpha)/l;  
r = y\*((epsilon-1)/epsilon)\*alpha/k(-1);  
i = k-(1-delta)\*k(-1);  
end;

initval;  
k = 9;  
c = 0.7;  
l = 0.3;  
w = 2.00;  
r = 0.00;  
z = 0;  
end;

endval;  
z = 0.1;  
end;

steady;

check;

simul(periods=1000);  
dsample 60;  
rplot k;

the the figure I obtain is not for the first 60 periods but for 1000 periods.

I try to reduce the time window. However, I get neither an error message nor does matlab display the desired figure.

Best

Chris

---

<div class="post-metadata">

**Author:** ![sebastien](https://forum.dynare.org/user_avatar/forum.dynare.org/sebastien/32/19973_2.png) [@sebastien](https://forum.dynare.org/u/sebastien)\
**Post date:** [9 March 2009 10:19 UTC](https://forum.dynare.org/t/dsample-command/955/2 "2009-03-09T10:19:29Z")

</div>

Hi

In Dynare 4.0.2 the dsample command is buggy. It will be fixed in the coming 4.0.3 release.

Sébastien

---

<div class="post-metadata">

**Author:** ![monetarist](https://forum.dynare.org/letter_avatar_proxy/v4/letter/m/6f9a4e/32.png) [@monetarist](https://forum.dynare.org/u/monetarist)\
**Post date:** [9 March 2009 10:54 UTC](https://forum.dynare.org/t/dsample-command/955/3 "2009-03-09T10:54:11Z")

</div>

Thank you.

So I’ll try it with an older version.

Best regards,

Chris

---

<div class="post-metadata">

**Author:** ![dgroll](https://forum.dynare.org/letter_avatar_proxy/v4/letter/d/c2a13f/32.png) [@dgroll](https://forum.dynare.org/u/dgroll)\
**Post date:** [31 January 2025 13:37 UTC](https://forum.dynare.org/t/dsample-command/955/4 "2025-01-31T13:37:15Z")

</div>

Hi Sebastien.

I am using Dynare 6.2 and when I use the command dsample I get the error message “Unrecognized function or variable ‘dsample’.”

This is the end of my code:

perfect\_foresight\_setup(periods=300);  
perfect\_foresight\_solver;  
dsample 250;  
options\_.rplottype=2;  
rplot X Y Z;

According to the Dynare Reference Manual Version 6, the dsample command is still available.

Thanks for any hints!

Best, Dominik

---

<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:** [31 January 2025 14:23 UTC](https://forum.dynare.org/t/dsample-command/955/5 "2025-01-31T14:23:14Z")

</div>

That is a bug. I erroroneously removed the file in [Remove unused dsample.m and mcompare.m (af274aec) · Commits · Dynare / dynare · GitLab](https://git.dynare.org/Dynare/dynare/-/commit/af274aec3fd64158cd8b7a5decb1b6932e3643c5)  
The bug will be fixed in Dynare 6.3. For now, you could simply download the file again.
