# Problam with bvar\_forecast

**URL:** <https://forum.dynare.org/t/problam-with-bvar-forecast/17867>\
**Category:** DSGE-VAR\
**Created:** [12 April 2021 11:25 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867 "2021-04-12T11:25:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahil](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@sahil](https://forum.dynare.org/u/sahil)\
**Post date:** [12 April 2021 11:25 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/1 "2021-04-12T11:25:24Z")

</div>

Dear Professor,

My model is working nicely until the estimation. However, when I am adding,

```
    bvar_forecast(forecast = 12, bvar_replic = 1000) 4; 

```

am getting the following error:

Nonfinite endpoints or increment for colon operator in index.  
Error in bvar\_toolbox (line 98)  
vprior.sig = std(dataset(options\_.first\_obs+options\_.presample-nlags:options\_.first\_obs+options\_.presample,:))’;

Error in bvar\_forecast (line 36)  
[ny, nx, posterior, prior, forecast\_data] = bvar\_toolbox(nlags);

Error in Woodford.driver (line 414)  
bvar\_forecast(4);

Error in dynare (line 293)  
evalin(‘base’,[fname ‘.driver’]) ;

Could you please help?

Thank you

Best Regards  
Sahil

---

<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:** [13 April 2021 08:16 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/2 "2021-04-13T08:16:41Z")

</div>

I would need to see the codes.

---

<div class="post-metadata">

**Author:** ![sahil](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@sahil](https://forum.dynare.org/u/sahil)\
**Post date:** [13 April 2021 09:58 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/3 "2021-04-13T09:58:39Z")

</div>

Dear Professor,

Thank you for your reply. Please find the attached files.  
[BVAR.zip](https://forum.dynare.org/uploads/short-url/bwwGAvTimlySoxmyBPGaBNO1C7z.zip) (8.3 KB)

Thank you

Best  
Sahil

---

<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:** [13 April 2021 10:22 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/4 "2021-04-13T10:22:57Z")

</div>

Why are you running a bvar\_forecast after estimating DSGE model? You need to estimate a BVAR.

---

<div class="post-metadata">

**Author:** ![sahil](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@sahil](https://forum.dynare.org/u/sahil)\
**Post date:** [13 April 2021 10:45 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/5 "2021-04-13T10:45:46Z")

</div>

I am doing this because I want to see the forecasting accuracy of the DSGE as compared to the BVAR. I am a bit confused if I am following the right procedure.

---

<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:** [13 April 2021 15:31 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/6 "2021-04-13T15:31:33Z")

</div>

You need two different files for that. One for the DSGE model and one for the VAR.

---

<div class="post-metadata">

**Author:** ![sakh97](https://forum.dynare.org/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@sakh97](https://forum.dynare.org/u/sakh97)\
**Post date:** [16 August 2021 21:56 UTC](https://forum.dynare.org/t/problam-with-bvar-forecast/17867/7 "2021-08-16T21:56:01Z")

</div>

I know that this is a late answer. You made a mistake. If you want to estimate the model with n lags must not include the first n observations.
