title: How do I specify a general GARCH-M model using the rugarch package in R
body: <p>I am currently trying to fit a <code>GARCH-M</code> model for option pricing as proposed by Duan (1995). </p>
  
  <p>Since this is my first post I cannot post pictures of the equation using the Google Chart API so I tried to create some HTML code below that displays the equations.</p>
  
  <p>The <code>GARCH dynamics</code> are specified as</p>
  
  <pre><code>x_t = r + \lambda \sigma_t - \sigma_t^2 / 2 + \varepsilon_t
  
  \sigma_t^2 = \omega + \alpha_1 \varepsilon_{t-1}^2 + \beta_1 \sigma_{t-1}^2
  </code></pre>
  
  <p>Equations in HTML below:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a href="https://www.codecogs.com/eqnedit.php?latex=x_t&amp;space;=&amp;space;r&amp;space;&amp;plus;&amp;space;\lambda&amp;space;\sigma_t&amp;space;-&amp;space;\frac{\sigma_t^2}{2}&amp;space;&amp;plus;&amp;space;\varepsilon_t&amp;space;\\&amp;space;\sigma_t^2&amp;space;=&amp;space;\omega&amp;space;&amp;plus;&amp;space;\alpha_1&amp;space;\varepsilon_{t-1}^2&amp;space;&amp;plus;&amp;space;\beta_1&amp;space;\sigma_{t-1}^2" target="_blank"&gt;&lt;img src="https://latex.codecogs.com/gif.latex?x_t&amp;space;=&amp;space;r&amp;space;&amp;plus;&amp;space;\lambda&amp;space;\sigma_t&amp;space;-&amp;space;\frac{\sigma_t^2}{2}&amp;space;&amp;plus;&amp;space;\varepsilon_t&amp;space;\\&amp;space;\sigma_t^2&amp;space;=&amp;space;\omega&amp;space;&amp;plus;&amp;space;\alpha_1&amp;space;\varepsilon_{t-1}^2&amp;space;&amp;plus;&amp;space;\beta_1&amp;space;\sigma_{t-1}^2" title="x_t = r + \lambda \sigma_t - \frac{\sigma_t^2}{2} + \varepsilon_t \\ \sigma_t^2 = \omega + \alpha_1 \varepsilon_{t-1}^2 + \beta_1 \sigma_{t-1}^2" /&gt;&lt;/a&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am using the <code>rugarch</code> package in <a href="/questions/tagged/r" class="post-tag" title="show questions tagged &#39;r&#39;" rel="tag">r</a>, but I cannot figure out how to specify the model. I know how to fit a standard GARCH-M model without the <code>\sigma_t^2 / 2</code> term, but how (if possible) do I specify the above model?</p>
  
  <p><code>Standard GARCH-M</code> code with fixed mu (r):</p>
  
  <pre><code>library(rugarch)
  data(sp500ret)
  spec &lt;- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1), external.regressors = NULL),
                 mean.model = list(armaOrder = c(0,0), include.mean = TRUE, archm = TRUE, archpow = 1),
                 fixed.pars = list(mu = 0))
  fit &lt;- ugarchfit(spec = spec, data = sp500ret)
  fit
  </code></pre>
  
  <p>The flexibility seems quite limited in <code>mean.model</code> so I am seeking some input on how to do this.</p>