Hello I am new to the forum and completely new to Eviews programming. I have two series of data (call them series1 and series2) as well as a series specifying a year (year) and a series specifying an industry (industry). For each year and each industry, I would like to perform an equality test between the median of that specific set of series1 and series2 (10 years times 9 industries = 90 sets). It seems that what I need to do is create a nested for loop that creates two new series for each of these sets, creates a group, and proceeds to run and record an equality test. So something like this (using pseudo-code):
For i = 2004 through 2013
For j = 1 through 10 (referring to the industry)
newseries1 = series1 if year = i AND industry = j
newseries2 = series2 if year = i AND industry = j
newgroup = newseries1 and newseries2
run equality test for medians between newseries1 and newseries2 in newgroup (testbtw function)
record full results of median equality test
End For
End For
.
I can easily assign a number 1 through 90 to each "industry year" if that is simpler than creating a nested for loop. Any comments would be greatly appreciated. Thank you
**EDIT: I should add that I am using Eviews 8**
defining multiple groups in nested loop with equality tests
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: defining multiple groups in nested loop with equality te
Something like:
Code: Select all
group g series1 series2
for !i=2004 to 2013
for !j = 1 to 10
smpl if year=!i and industry=!j
freeze(tab_!i_!j) g.testbtw(med)
next
next
Follow us on Twitter @IHSEViews
Re: defining multiple groups in nested loop with equality te
This is perfect and exactly what I was looking for. Can't thank you enough.
Is there an additional line of code I can add that could compile all of these output tabs (vertically) into a single output sheet that I can then manually import into excel?
Is there an additional line of code I can add that could compile all of these output tabs (vertically) into a single output sheet that I can then manually import into excel?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: defining multiple groups in nested loop with equality te
Code: Select all
spool s
group g series1 series2
for !i=2004 to 2013
for !j = 1 to 10
smpl if year=!i and industry=!j
freeze(tab_!i_!j) g.testbtw(med)
s.append tab_!i_!j
next
next
s.save(t=csv) myfile.csv
Follow us on Twitter @IHSEViews
two-sample equality tests
Hi, I have a series x and a classification variable 'hour' with value 1 or 2. How to write a program to test the difference between the mean, median and standard deviation for the two samples. I understand that two-sample tests can be done interactively but I have many series. How to write a program for the tests? Thanks a lot for your help. Howard
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Who is online
Users browsing this forum: Google [Bot] and 14 guests