diff --git a/doc/dynare.texi b/doc/dynare.texi
index 3edecb3186e03cbb8bb374e4591063c39b52b363..56da4a6f098ea7e5f094fe22c3df7ed3b9113936 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -6958,11 +6958,19 @@ Multi-country RBC model with time to build, presented in @cite{Backus,
 Kehoe and Kydland (1992)}.
 @end table
 
+@item agtrend.mod
+Small open economy RBC model with shocks to the growth trend, presented
+in @cite{Aguiar and Gopinath (2004)}.
+
 @node Bibliography
 @chapter Bibliography
 
 @itemize
 
+@item
+Aguiar, Mark and Gopinath, Gita (2004): ``Emerging Market Business
+Cycles: The Cycle is the Trend,'' @i{NBER Working Paper}, 10734
+
 @item
 Backus, David K., Patrick J. Kehoe, and Finn E. Kydland (1992):
 ``International Real Business Cycles,'' @i{Journal of Political
diff --git a/examples/agtrend.mod b/examples/agtrend.mod
new file mode 100644
index 0000000000000000000000000000000000000000..a50748707b74391f8fb2e91275d99bffe5167815
--- /dev/null
+++ b/examples/agtrend.mod
@@ -0,0 +1,165 @@
+/*
+ * This file replicates the model studied in:
+ * Aguiar, Mark and Gopinath, Gita (2004): "Emerging Market Business Cycles:
+ * The Cycle is the Trend" (NBER WP 10734)
+ *
+ * This implementation was written by Sébastien Villemot. Please note that the
+ * following copyright notice only applies to this Dynare implementation of the
+ * model.
+ */
+
+/*
+ * Copyright (C) 2012 Dynare Team
+ *
+ * This file is part of Dynare.
+ *
+ * Dynare is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Dynare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+// Set the following variable to 0 to get Cobb-Douglas utility
+@#define ghh = 1
+// Set the following variable to 0 to get the calibration for Canada
+@#define mexico = 1
+
+var c k y b q g l u z uc ul f c_y tb_y i_y;
+
+varexo eps_z eps_g;
+
+parameters mu_g sigma rho_g sigma_g delta phi psi b_star alpha rho_z sigma_z r_star beta;
+
+// Benchmark parameter values (table 3)
+@#if ghh == 1
+parameters tau nu;
+tau = 1.4;
+nu = 1.6;
+@#else
+parameters gamma;
+gamma = 0.36;
+@#endif
+
+alpha = 0.68;
+sigma = 2;
+delta = 0.03;
+beta = 0.98;
+psi = 0.001;
+b_star = 0.1;
+
+// Estimated parameters (table 4)
+@#if mexico == 1
+@# if ghh == 1
+mu_g = 1.006;
+sigma_z = 0.0041;
+rho_z = 0.94;
+sigma_g = 0.0109;
+rho_g = 0.72;
+phi = 3.79;
+@# else
+mu_g = 1.005;
+sigma_z = 0.0046;
+rho_z = 0.94;
+sigma_g = 0.025;
+rho_g = 0.06;
+phi = 2.82;
+@# endif
+@#else
+// Canada
+@# if ghh == 1
+mu_g = 1.007;
+sigma_z = 0.0057;
+rho_z = 0.88;
+sigma_g = 0.0014;
+rho_g = 0.94;
+phi = 2.63;
+@# else
+mu_g = 1.007;
+sigma_z = 0.0072;
+rho_z = 0.96;
+sigma_g = 0.0044;
+rho_g = 0.50;
+phi = 3.76;
+@# endif
+@#endif
+
+@#if ghh == 1
+r_star = mu_g^(-sigma)/beta - 1;
+@#else
+r_star = mu_g^(1-gamma*(1-sigma))/beta - 1;
+@#endif
+
+model;
+y=exp(z)*k(-1)^(1-alpha)*l^alpha; // Production technology (1)
+z = rho_z*z(-1)+sigma_z*eps_z; // Transitory shock (2)
+log(g) = (1-rho_g)*log(mu_g)+rho_g*log(g(-1))+sigma_g*eps_g; // Trend shock
+@#if ghh == 1
+u = (c-tau*l^nu)^(1-sigma)/(1-sigma); // GHH utility (3)
+uc = (c - tau*l^nu)^(-sigma);
+ul = -tau*nu*l^(nu-1)*(c - tau*l^nu)^(-sigma);
+f = beta*g^(1-sigma);
+@#else
+u = (c^gamma*(1-l)^(1-gamma))^(1-sigma)/(1-sigma); // Cobb-Douglas utility (4)
+uc = gamma*u/c*(1-sigma);
+ul = -(1-gamma)*u/(1-l)*(1-sigma);
+f = beta*g^(gamma*(1-sigma));
+@#endif
+c+g*k=y+(1-delta)*k(-1)-phi/2*(g*k/k(-1)-mu_g)^2*k(-1)-b(-1)+q*g*b; // Resource constraint (5)
+1/q = 1+r_star+psi*(exp(b-b_star)-1); // Price of debt (6)
+uc*(1+phi*(g*k/k(-1)-mu_g))*g=f*uc(+1)*(1-delta+(1-alpha)*y(+1)/k+phi/2*(g(+1)*k(+1)/k-mu_g)*(g(+1)*k(+1)/k+mu_g)); // FOC wrt to capital (10)
+ul+uc*alpha*y/l=0; // Leisure-consumption arbitrage (11)
+uc*g*q=f*uc(+1); // Euler equation (12)
+
+tb_y = (b(-1)-g*q*b)/y; // Trade balance to GDP ratio
+c_y = c/y; // Consumption to GDP ratio
+i_y = (g*k-(1-delta)*k(-1))/y; // Investment to GDP ratio
+end;
+
+initval;
+q = 1/(1+r_star);
+b = b_star;
+z = 0;
+g = mu_g;
+
+c = 0.583095;
+k = 4.02387;
+y = 0.721195;
+l = 0.321155;
+
+@#if ghh == 1
+u = (c-tau*l^nu)^(1-sigma)/(1-sigma);
+uc = (c - tau*l^nu)^(-sigma);
+ul = -tau*nu*l^(nu-1)*(c - tau*l)^(-sigma);
+f = beta*g^(1-sigma);
+@#else
+u = (c^gamma*(1-l)^(1-gamma))^(1-sigma)/(1-sigma);
+uc = gamma*u/c*(1-sigma);
+ul = -(1-gamma)*u/(1-l)*(1-sigma);
+f = beta*g^(gamma*(1-sigma));
+@#endif
+
+tb_y = (b-g*q*b)/y;
+c_y = c/y;
+i_y = (g*k-(1-delta)*k)/y;
+end;
+
+shocks;
+var eps_g = 1;
+var eps_z = 1;
+end;
+
+steady;
+
+check;
+
+// Plot impulse response functions (figure 4)
+stoch_simul tb_y c_y i_y;