# How to output a variable defined in the model?

**URL:** <https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519>\
**Category:** How-to\
**Created:** [September 8, 2021, 7:42pm UTC](https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519 "2021-09-08T19:42:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pawangpt700](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/pawangpt700/32/387_2.png) [@pawangpt700](https://discourse.pumas.ai/u/pawangpt700)\
**Post date:** [September 8, 2021, 7:42pm UTC](https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519/1 "2021-09-08T19:42:39Z")

</div>

How can we output a time-varying variable, defined in the model using the inspect/predict output function?

---

<div class="post-metadata">

**Author:** ![vijay](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/vijay/32/96_2.png) [@vijay](https://discourse.pumas.ai/u/vijay)\
**Post date:** [September 8, 2021, 8:13pm UTC](https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519/2 "2021-09-08T20:13:46Z")

</div>

Hi Pawan,

You can use the `icoef` function. You can look for the usage by doing `?icoef` in the REPL

Vijay

---

<div class="post-metadata">

**Author:** ![pawangpt700](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/pawangpt700/32/387_2.png) [@pawangpt700](https://discourse.pumas.ai/u/pawangpt700)\
**Post date:** [September 8, 2021, 10:21pm UTC](https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519/3 "2021-09-08T22:21:16Z")

</div>

> [@vijay](#):
>
> icoef

Hi Vijay, thank you for your reply. I think by _icoef_ we can only output variables defined in the _pre_ block. But, I was wondering how can we output a time-varying variable defined in either _var_ or _observed_ block by _inspect_ or _predict_ function?

---

<div class="post-metadata">

**Author:** ![andreasnoack](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/andreasnoack/32/22_2.png) [@andreasnoack](https://discourse.pumas.ai/u/andreasnoack)\
**Post date:** [September 9, 2021, 6:56am UTC](https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519/4 "2021-09-09T06:56:59Z")

</div>

Our `predict` function is tightly associated with the modeled variables, i.e. the random variables in the `@derived` block. If you want to output the variables from the `@observed` block then you can use `simobs`. It should be possible to call `DataFrame` on the output to convert it to a `DataFrame`.

---

<div class="post-metadata">

**Author:** ![pawangpt700](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/pawangpt700/32/387_2.png) [@pawangpt700](https://discourse.pumas.ai/u/pawangpt700)\
**Post date:** [September 10, 2021, 12:53pm UTC](https://discourse.pumas.ai/t/how-to-output-a-variable-defined-in-the-model/519/5 "2021-09-10T12:53:26Z")

</div>

Thank you, @andreasnoack.
