Page 1 of 2
How to specify a series range
Posted: Tue May 03, 2016 8:04 am
by eviews1
Hello,
Could you help to restrict the series that I add to a series of groups I create?
I am trying to create groups (can_x_us_x{!i}) from two series (can_x and us_x) with the same start date (1961) and different end dates (2010 tp 2014).
It seems that sample command does not do that.
'create recursive groups
for !i=2010 to 2014
group can_x_us_x{!i}
' smpl 1961 !i 'does not constraint
can_x_us_x{!i}.add can_x us_x
next
Thank you.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:06 am
by EViews Gareth
Your question doesn't make sense. All series in a workfile page, and thus all groups, have the same start date and end date.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:11 am
by eviews1
Yes I see that all groups created by the code are of the same size.
I am trying to create say group can_x_us_x2010 that contains two original series in the range 1961-2010 etc (original series are from 1961 to 2014)
Re: How to specify a series range
Posted: Tue May 03, 2016 8:16 am
by EViews Gareth
Groups are always of the same size as the workfile range. Typically in EViews you would set the sample to be the observations you are interested in, then do your analysis. EViews only uses whatever observations are in the current sample.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:19 am
by eviews1
But you can run a regression on smaller size than your sample. In the same way I assume there should be a way to specify groups on sub-samples. (Eventually I try to run Johansen cointegration tests on those sub-sample groups)
Re: How to specify a series range
Posted: Tue May 03, 2016 8:26 am
by EViews Gareth
No, you cannot run a regression on a smaller size than your sample. If you want to run a regression on a smaller sample than the current sample, you set a different sample. Everything is based on the sample.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:27 am
by startz
Think of series, and thus groups, as always holding the maximum amount of information. You then use smpl to do procedures on selected subsamples.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:28 am
by eviews1
Gareth as you said "Typically in EViews you would set the sample to be the observations you are interested in, then do your analysis.". Ho w can I do that in a piece of my code.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:31 am
by startz
Gareth as you said "Typically in EViews you would set the sample to be the observations you are interested in, then do your analysis.". Ho w can I do that in a piece of my code.
I'm not sure I really understand your question, but
Re: How to specify a series range
Posted: Tue May 03, 2016 8:39 am
by eviews1
Startz what you posted applies to a regression. You restrict the sample size to what you want. It is correct.
I am trying to do a slightly different thing . I want to create groups with different sample sizes. I thought smpl date1 to date2 in the piece of code below would do that but it did not work
After running the code below I expected to have the following groups (The original series can_x and us_x have the sample size 1961-2014).
can_x_us_x2010 (containing two series can_x us_x over 1961-2010)
can_x_us_x2011 (containing two series can_x us_x over 1961-2011)
...
can_x_us_x2011 (containing two series can_x us_x over 1961-2014)
create recursive groups
for !i=2010 to 2014
group can_x_us_x{!i}
' smpl 1961 !i 'does not constraint
can_x_us_x{!i}.add can_x us_x
next
Re: How to specify a series range
Posted: Tue May 03, 2016 8:42 am
by EViews Gareth
I'm not sure how we can say this any differently.
Groups cannot have different lengths. They always have the same number of rows. That number of rows is equal to the number of observations in the workfile. That cannot change. You cannot create groups with different numbers of rows.
You should create a group containing the series you are interested in, then set the sample to the rows you are interested in, then do your analysis (regression, cointegration test, make a graph, whatever). Then if you want to do something on a different set of rows, change the sample again and use the same group.
Re: How to specify a series range
Posted: Tue May 03, 2016 8:58 am
by eviews1
Ok. How then select a series with a size that is smaller than the sample size.
Say my series is X from 1961 to 2014. I would like to have it only from 1961 to 2010. I tried X(1961, 2010) X(1961 2010) but it did not work.
Re: How to specify a series range
Posted: Tue May 03, 2016 9:02 am
by startz
You don't select aspects of the particular series. The smpl statement tells EViews to apply all operations to the selected sample. This is different from what's done in general purpose programming languages.
You might want to take a look at
http://www.eviews.com/illustrated/EView ... trated.pdf.
Re: How to specify a series range
Posted: Tue May 03, 2016 9:03 am
by EViews Gareth
Ok. How then select a series with a size that is smaller than the sample size.
Say my series is X from 1961 to 2014. I would like to have it only from 1961 to 2010. I tried X(1961, 2010) X(1961 2010) but it did not work.
You don't. A series has a set size. You cannot change the size of a series. If you only want to use the observations between 1961 and 2010, set the sample to be 1961 2010, and EViews will only use those observations.
Re: How to specify a series range
Posted: Tue May 03, 2016 10:32 am
by eviews1
Richard and Gareth, I got your point that you cannot change series but can select specific observations. How then I can tweak my code to select specific observations. I thought smpl 1961 !1 will do that.
'create recursive groups
for !i=2013 to 2014
group can_x_us_x{!i} 'create groups
smpl 1961 !i 'use specified range of observations
can_x_us_x{!i}.add can_x us_x 'add series to a group
next
Thank you.