Hello,
I am working on a group of variables and running autoregression and forecasting monthly values. Since it is a group function, to run autoregression, I need to set last observation date and for forecasting I need to get (last observation date+next month). What formula can I use to resolve this, as the last observation date differs across variables?
For example,
smpl 2000Q1 (code for latest quarter for each variable)
group all_variables variable_1 variable_2 variable_3
for !i = 1 to all_variables.@count
smpl 2000Q1 (code for latest quarter for each variable)
%i= all_variables.@seriesname(!i)
equation eq_{!i}.ls {%i} c ar(1)
'Forecasts
smpl (code for latest quarter for each variable+1 quarter) 2018Q4
eq_{!i}.forecast {%i}_fcst
Getting last observation and (last observation + 1 month) date in eviews
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13309
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting last observation and (last observation + 1 month) date in eviews
Code: Select all
%last = {%i}.@last
smpl {%last}+1 @last
Follow us on Twitter @IHSEViews
Re: Getting last observation and (last observation + 1 month) date in eviews
Thank you for replying. I am relatively new to Eviews. When I try the codes you suggested, I get the error @last is not defined or is an illegal command. Any way to fix this?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13309
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting last observation and (last observation + 1 month) date in eviews
I fixed a typo, try again.
Follow us on Twitter @IHSEViews
Re: Getting last observation and (last observation + 1 month) date in eviews
This worked! Thank you so much
Re: Getting last observation and (last observation + 1 month) date in eviews
I have a similar task. I'm trying to use automatic ARIMA modelling to complete the quarter for several variables. Some end in m10 and some end in m11. How do I modify the code so that a variable that ends at m10 has two forecasted months (m11 and m12), whereas a variable that has data to m11 only produces a forecast for m+1 (m12)?
As an example, this is how I've been doing it (manually):
for %c gr at 'countries with data going to 2022m10
smpl 2006 2022m10' update
i_{%c}.autoarma(eqname=e_i_{%c}) i_{%c}_f c spike2020m4 spike2020m4(-1)
smpl 2022m11 2022m12
e_i_{%c}.forecast i_{%c}f
series i_{%c}=i_{%c}f
next
for %c be cz fi fr ro es 'countries with data going to 2022m11
smpl 2006 2022m11
i_{%c}.autoarma(eqname=e_i_{%c}) i_{%c}_f c spike2020m4 spike2020m4(-1)
smpl 2022m12 2022m12
e_i_{%c}.forecast i_{%c}f
series i_{%c}=i_{%c}f
next
Any help is greatly appreciated.
AH
As an example, this is how I've been doing it (manually):
for %c gr at 'countries with data going to 2022m10
smpl 2006 2022m10' update
i_{%c}.autoarma(eqname=e_i_{%c}) i_{%c}_f c spike2020m4 spike2020m4(-1)
smpl 2022m11 2022m12
e_i_{%c}.forecast i_{%c}f
series i_{%c}=i_{%c}f
next
for %c be cz fi fr ro es 'countries with data going to 2022m11
smpl 2006 2022m11
i_{%c}.autoarma(eqname=e_i_{%c}) i_{%c}_f c spike2020m4 spike2020m4(-1)
smpl 2022m12 2022m12
e_i_{%c}.forecast i_{%c}f
series i_{%c}=i_{%c}f
next
Any help is greatly appreciated.
AH
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13309
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Getting last observation and (last observation + 1 month) date in eviews
Could always just set the sample to be whenever the series has NA:
Also, why use the autoarima forecast, and then produce the same forecast from an equation?
Code: Select all
smpl if i_{%c} = na
Also, why use the autoarima forecast, and then produce the same forecast from an equation?
Follow us on Twitter @IHSEViews
Re: Getting last observation and (last observation + 1 month) date in eviews
Thank you.
Good question! On reflection, the autoarma would automatically produce an "f" for the specified forecast period, wouldn't it? All I need to do is rename it!
Good question! On reflection, the autoarma would automatically produce an "f" for the specified forecast period, wouldn't it? All I need to do is rename it!
Who is online
Users browsing this forum: No registered users and 15 guests