Page 1 of 1

defining multiple groups in nested loop with equality tests

Posted: Tue Jul 01, 2014 7:09 am
by wicker6m
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**

Re: defining multiple groups in nested loop with equality te

Posted: Tue Jul 01, 2014 9:16 am
by EViews Gareth
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

Re: defining multiple groups in nested loop with equality te

Posted: Tue Jul 01, 2014 10:15 am
by wicker6m
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?

Re: defining multiple groups in nested loop with equality te

Posted: Tue Jul 01, 2014 11:17 am
by EViews Gareth

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

two-sample equality tests

Posted: Sun Oct 18, 2015 10:20 am
by COM446
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

Re: defining multiple groups in nested loop with equality te

Posted: Sun Oct 18, 2015 12:15 pm
by EViews Gareth