Hello,

I want to apply risk-return approach to DSGE modeling.My intention is to model the change in exposure to risky asset due to change in monetary policy.The utility function agent maximizes goes like this:

```
U=consumption - risk aversion* ((proportion of portfolio invested in risky asset)^2 )* variance of the risky asste return
```

Return on risky asset is determined on the market in every period.The share invested in risky asset is determined as ratio of expected return and variance of the return.Dynare calculates expected value of returns, but my problem is how to get variance of the return.

The use of historical variance(variance calculated based on the previous realisation of random variable- i.e.return) is not an option because I understand that expected values in Dynare are not calculated using historical data,hence comparing it with historical variance won’t be meaningful.

So, I understand that I need ex-ante variance E(x-E(x))^2] but don’t know how to calculate it in Dynare.In the function section of manuals there is no function for calculation of variance.

If you have any clue please help!