I am trying to create a sample dynamics, the total sample has 8 years of data daily, and I want run a regression for each quarter, therefore, each quarter would be a new small sample...
My code lines are thus:
!i=1
while !i<32
smpl trim(!i) (trim(!i+1)-1)
equation reg1.ls alpha c ibrx
equation reg2.ls amaz c ibrx
equation reg3.ls bb c ibrx
equation reg4.ls brad c ibrx
equation reg5.ls itau c ibrx
equation reg6.ls unibanco c ibrx
!i=!i+1
wend
The code of error is "Error in Sample: Illegal date trims(1) in "SMPL aux(1) (aux(1+1)-1)""
how to access the lines of vector tim in eviews?
Thanks in Advance
scalar in smpl
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
scalar in smpl
Last edited by rogerioms on Thu Apr 16, 2009 11:59 am, edited 1 time in total.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: scalar in smpl
What is trim?
I can't really follow what you're trying to do with that while loop.
I can't really follow what you're trying to do with that while loop.
Re: scalar in smpl
trim is a vector which says where begins each quarter
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: scalar in smpl
Create program variables first:
Code: Select all
!i=1
while !i<32
!first = trim(!i)
!last = trim(!i+1)-1
smpl !first !last
equation reg1.ls alpha c ibrx
equation reg2.ls amaz c ibrx
equation reg3.ls bb c ibrx
equation reg4.ls brad c ibrx
equation reg5.ls itau c ibrx
equation reg6.ls unibanco c ibrx
!i=!i+1
wend
Re: scalar in smpl
Thank you, the code work very well. I think it strange that when I included a variable in smpl he gave a "illegal date" and with you worked all right, you know why???
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: scalar in smpl
EViews won't accept a vector as a valid date for a sample. Even though you were only referencing a single element of the vector (i.e. a scalar), EViews only saw it as a vector, so rejected it.
There are many cases in EViews programming (actually all programming really) where you, as a human, know that two things are equivalent (a single element of a vector is equivalent to a scalar), but the programming language does not.
There are many cases in EViews programming (actually all programming really) where you, as a human, know that two things are equivalent (a single element of a vector is equivalent to a scalar), but the programming language does not.
Re: scalar in smpl
Hi,
I got a similar problem here, with eviews sending me an error message of an illegal date.
Here's my code :
Now if I run just this piece of code alone I get the following error message :
"Error in Sample: Illegal date %DEBUT_ESTIM in"SMPL %DEBUT_ESTIM %FIN_ESTIM"".
I did not manage to figure out why it is bugging there. Can you help me?
I got a similar problem here, with eviews sending me an error message of an illegal date.
Here's my code :
Code: Select all
'==================================================================================
%debut_wf = "1998:2" ' date de debut du workfile
%fin_wf = "2014:4" ' date de fin du workfile
%debut_estim = "1999:1" ' date de debut de l'estimation
%fin_estim = "2013:4" ' date de fin de l'estimation
%fin_data = "2014:4" ' date de fin de disponibilité des données des comptes trimestriels
'==================================================================================
' Chargement des données
cd "S:\SPMAE\PREV\Prev3\_Fichiers_Prev3\Prod_manuf\05-Etalonnages\03-Enq_PMI\etalonnages_2014"
workfile modeles_pmi.wf1 q %debut_wf %fin_wf
' Charger les données
read(t=xls,b2,s=data) data_pmi.xls 27
genr dummy1 = @recode(@date=@dateval("2008:4"), 1, 0)
genr dummy2 = @recode(@date=@dateval("2009:1"), 1, 0)
' Prévision de T en T-1
smpl %debut_estim %fin_estim
equation eqm2t1.ls dlyman c cg_m2(-1)-sto_m2(-1)
Code: Select all
smpl %debut_estim %fin_estim"Error in Sample: Illegal date %DEBUT_ESTIM in"SMPL %DEBUT_ESTIM %FIN_ESTIM"".
I did not manage to figure out why it is bugging there. Can you help me?
Re: scalar in smpl
The code works fine.
If you run that specific line alone, then you will get error message. As far as EViews is concerned, %debut_estim and %fin_estim are not yet defined. You should provide all the necessary information:
If you run that specific line alone, then you will get error message. As far as EViews is concerned, %debut_estim and %fin_estim are not yet defined. You should provide all the necessary information:
Code: Select all
%debut_estim = "1999:1"
%fin_estim = "2013:4"
smpl %debut_estim %fin_estimWho is online
Users browsing this forum: No registered users and 1 guest
