Hi,
Is there a way to get the Sample (adjusted) from an equation and save it as a smpl object? I have lags in the model so the model cuts the original sample period short. Please let me know. Thanks guys.
Tchaithonov
Adjusted Sample from Equation
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: Adjusted Sample from Equation
You can come pretty close to this with
Code: Select all
series adjustedSampleDummy = resid<>NA
smpl if adjustedSampleDummy-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: Adjusted Sample from Equation
Looks like this would do the trick. Thanks.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Adjusted Sample from Equation
This is the best way to do this, but one caution...using RESID as the test series only works if the equation was just estimated. It is safer in most cases to first make the residual from the equation using the makeresid proc, then to do the test using the newly created series.
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: Adjusted Sample from Equation
Hi, I just have a follow-up question.
if I want to generate the "if" part for smpl -- say I have a bunch of cross-sections that I want to deal with -- and I have the following code and a table containing the cx numbers:
Neither "smpl if {%filter}" nor "smpl if %filter" does not work. Do you have any ideas what I should do about this? Please let me know. Thanks.
Tchaithonov
if I want to generate the "if" part for smpl -- say I have a bunch of cross-sections that I want to deal with -- and I have the following code and a table containing the cx numbers:
Code: Select all
!i = 1
while tab1(!i,1) <> ""
if !i = 1 then
%filter = "cx = " + @str(!i)
else
%filter = %filter + " OR cx = " %str(!i)
endif
!i = !i + 1
wend
Tchaithonov
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Adjusted Sample from Equation
Your else part seems to be missing a plus sign.
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: Adjusted Sample from Equation
Oops. . that's just typo .. but after the correction, it's still not working. In fact, what I am trying to do is to create 3 sets of smpl's to run 3 panel data regressions with different combinations of cx's. So, my smpl statement is this (this is within a for loop from 1 to 3):
Eviews keeps saying this:
Code: Select all
!i = 1
while tab1(!i,1) <> ""
if !i = 1 then
%filter = "cx = " + @str(!i)
else
%filter = %filter + " OR cx = " %str(!i)
endif
!i = !i + 1
wend
sample sample{!i} 01/01/2004 12/31/2008 if adjustedsampledummy AND %filter
....
If I use %filter, it reads as "ILTER", and complains that it is not defined; if I use {%filter}, it says that there is a syntax error and {%filter} shows up as empty; . So, here's where I am stuck. Should I just run the regression right underneath a simpler sample statement, or is there a different way to go around this issue? Please let me know. Thanks very much.Error in Sample: ILTER is not defined in "SAMPLE SAMPLE{!I} 01/01/2004 12/31/2008 IF ADJUSTEDSAMPLEDUMMY AND ILTER"
Last edited by tchaithonov on Wed Aug 05, 2009 8:36 am, edited 1 time in total.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Adjusted Sample from Equation
You need to put %filter in braces.
This works:
This works:
Code: Select all
create m 2004 2008
series adjustedsampledummy = nrnd>0
%filter = "nrnd>0"
sample s1 01/01/2004 12/31/2008 if adjustedsampledummy and {%filter}
-
tchaithonov
- Posts: 168
- Joined: Mon Apr 13, 2009 7:39 am
- Location: New York City
Re: Adjusted Sample from Equation
I found out that it's related to the codes I wrote in the prior part of the program. I guess you've helped solving my mystery. Thanks Gareth.
Who is online
Users browsing this forum: No registered users and 2 guests
