ANOVA/ Hypothesis Testing (Multiple Means)

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

ANOVA/ Hypothesis Testing (Multiple Means)

Postby px41 » Mon Mar 21, 2011 1:59 pm

Hi Good Day.

I am using Eviews 7 and I am interested in running an ANOVA test to test the means for the closing prices of companies for different weekdays (Mon-Fri). I know there's the Simple Hypothesis Test (View>Descriptive Statistics & Tests>Simple Hypothesis Tests) where I actually plan to test for significant differences between means of Mondays (using my time series workfile for a company) against the means of Tuesdays (the test value) etc. Also, I've played around with the Equality Tests (View>Descriptive Statistics& Tests>Equality Tests by Classification) and it worked fine for my time series data per company. I was able to test whether or not the means were significantly different by weekday, and month per company using the "@weekday" and "@month" in the "Series/Group for Classify" field.

However, I just have two queries.

Firstly, how can I use Eviews 7 to merge my separate company files in to one workfile? It might be useful to have it as such (date in rows, firms in columns):

________ Firm A Firm B Firm C etc
date1 $ (closing price) $ $
date2 $ $ $
date3 $ $ $
etc



My data for each company currently looks like:

Firm A
date1 $ (closing price)
date2 $
date3 $


In my mind I hope that by organizing it this way I can test the hypothesis of equal means for ALL companies at once (eg, for weekdays means of all companies it'll be Ho: u1=u2=u3=u4=u5 and H1: At least two means are not equal).

Secondly, is this type of data organization necessary? Can Eviews7 use this organization of data to test equality of means or can I only do the ANOVA for each company individually?

I'm not sure how the structure of the data should be when it comes to doing an ANOVA for more than one company at a time especially when its the day of the week means I'm trying to test. I've tried to explain my problem as simply and clearly as possible but if further explanation is needed, I will gladly provide it.

If it helps, my overall aim is to test for possible significant differences in the mean stock prices for weekdays and then for months and my workfiles are separate company files containing times series data.

Thanking you very much in advance.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: ANOVA/ Hypothesis Testing (Multiple Means)

Postby EViews Glenn » Mon Mar 21, 2011 3:11 pm

If I'm understanding correctly what it is you wish to do...

You'll want to create a stacked panel data which combines the data from the original files (I'm assuming they are already in workfile form since you said you've done the tests).

1. In each of your company files, create a new alpha series COMPANY which has the name of the FIRM and a series DATE which is equal to @DATE. We will use these values when we combine the data. Note that the FIRM series has the same value for all of the observations in a given company files.

2. Make a copy of the first company file.

3. In this new first company file, append each of the remaining files using the Proc/Append procedure in the workfile toolbar. This just adds the observations from the specified workfile to the bottom of the current workfile. The default settings in the dialog should be okay.

4. Click on the workfile proc Structure/Resize current page and structure your new workfile as a dated panel. Use FIRM as the cross-section identifier and DATE as the period identifier.

Note that all of the above can be done programatically if more convenient. Alternately, if you want you can stack the firm data outside of EViews then read it in in stacked form, then do step 4.

This set of steps should create a stacked panel file with the same dates as before and number-of-firms cross-sections.

Now you should be able to do your ANOVA using day-of-week as the by-factor. Since day-of-week is the factor, EViews will compute averages for a given day-of-week across all firms and dates, and test the equality of means.

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: ANOVA/ Hypothesis Testing (Multiple Means)

Postby px41 » Mon Mar 21, 2011 3:55 pm

Hmm, I see. Alright, I will attempt what your have prescribed. You last sentence does seem in line with what I'm trying to achieve. Will let you know if it work or if I'm having trouble executing the said steps. Thanks so much for your advice Mr.Glenn.

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: ANOVA/ Hypothesis Testing (Multiple Means)

Postby px41 » Tue Mar 22, 2011 10:19 am

Hi Mr.Glenn,

I've run through the steps you gave and I seem to have the biggest problem with carrying out the first step. I know how to simply create an alpha series ( I use the "alpha filename" command) but after experimenting and facing some errors I have to conclude that I'm not sure how to "create a new alpha series COMPANY which has the name of the FIRM and a series DATE which is equal to @DATE".

Here's what I tried.

You suggested: "...create a new alpha series COMPANY which has the name of the FIRM..."

I created an alpha series and literally named it one of my company names using the said command.

You went on: "...and a series DATE which is equal to @DATE."

I really did not know what to do here so I went on to the next step nevertheless (expecting problems of course!). When I did try to enter "date" or "firm" as identifiers for the series I would get "FIRM" is not defined or "DATE" is not defined.

I've read Gareth's thread on entering data but I must be doing something wrong because I cant seem to establish identifiers. I tried the alternative by stacking a few companies together in excel then trying step 4, but again I ran into the "date" or "firm" not defined error (same errors i encountered when trying step 1). The workfiles I have were imported from excel (it was simple panel data: daily dates down the rows, closing stock price down the first column) using a 7 day week (though i'm ignoring data for weekends.)

I know it's probably something simple I must be overlooking so I ask again for some help with this please, in particular the first step which seems most important.

Thanking you in advance.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: ANOVA/ Hypothesis Testing (Multiple Means)

Postby EViews Glenn » Tue Mar 22, 2011 12:24 pm

In the command line

Code: Select all

alpha firm = "name" series date = @date
where name is the name of the firm.

px41
Posts: 24
Joined: Wed Mar 02, 2011 7:44 pm

Re: ANOVA/ Hypothesis Testing (Multiple Means)

Postby px41 » Tue Mar 22, 2011 1:13 pm

Oooooooh I see. I tried it a for a sample of my companies and it worked fine! Hopefully it'll work for all 40 companies in one workfile. Thanks again Mr.Glenn! Much appreciated.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 0 guests