sample in a group

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

martingale
Posts: 51
Joined: Tue Jul 24, 2012 11:36 am

sample in a group

Postby martingale » Sat Jan 26, 2013 9:07 am

Use Eviews 7.

I have a group consisting of daily returns of individual stocks. Need a sample that shows only daily returns of individual stocks above market return and make a new group with these observations. How can this be done? A spesific solution would be greatly appreciated.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13586
Joined: Tue Sep 16, 2008 5:38 pm

Re: sample in a group

Postby EViews Gareth » Sat Jan 26, 2013 12:59 pm

You'll have to be more explicit as to what you're trying to do.

martingale
Posts: 51
Joined: Tue Jul 24, 2012 11:36 am

Re: sample in a group

Postby martingale » Sun Jan 27, 2013 1:49 am

Example
group members:
Company1 return 0,01
Company2 return 0,04
Company3 return 0,04
Market return 0,03

need to sample so that companies above market return form a new group, that is company2 and company3

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13586
Joined: Tue Sep 16, 2008 5:38 pm

Re: sample in a group

Postby EViews Gareth » Sun Jan 27, 2013 8:24 pm

Sorry, that still isn't clear.

You have a group. Roughly speaking, that's a matrix - each row is an observation, each column is a series. You want to set a sample (which selects observations, i.e. rows) so that the members of the group (i.e. columns) change. You can't do that.

martingale
Posts: 51
Joined: Tue Jul 24, 2012 11:36 am

Re: sample in a group

Postby martingale » Mon Jan 28, 2013 4:04 am

just did it in Excel

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: sample in a group

Postby trubador » Mon Jan 28, 2013 6:01 am

Code: Select all

'This part generates random data to simulate the current situation as I see it. wfcreate u 100 group full !market_ret = 0.01 for !i = 1 to 10 series y!i = nrnd full.add y!i next 'This is the actual part that is supposed to solve your problem (from my understanding of course). group sample for !i = 1 to full.@count %s = full.@seriesname(!i) if @mean({%s}) > !market_ret then sample.add {%s} endif next

martingale
Posts: 51
Joined: Tue Jul 24, 2012 11:36 am

Re: sample in a group

Postby martingale » Mon Jan 28, 2013 10:47 am

Thank you! Some adjustment is needed.

I have individual files of daily returns for companies and the daily returns of the market as a whole for the same period of time.

The name structure for the individual companies is:

R_N_companyX_P_

where the component companyX varies from company to company.

The name for the market returns is:

r_msnwayl

The group name which includes all the above is:
R

I need EViews to:
Compare each company daily return with the market return and create a new group with the observations which are greater than the daily market returns for each day. I have 1445 daily observations and 207 companies.

The purpose of this is to run a test of the cross sectional absolute deviation(CSAD):

CSAD(t)=Sum(i=1,N){(1/N)absolutevalue(R(i,t)-R(m,t)}

where R(i,t) is the return of company I at day t and R(m,t) is the market return at day t, and N is the number of observations that fulfill the requirement Ri>Rm at a given day.

The prediction of rational expectations is that in the equation:
CSAD(t)=gamma(0)+gamma(1)absolutevalue(R(m,t)+gamma(2)(R(m,t))^2
gamma(1) is positive and gamma(2) is zero.

If gamma(2) is negative and significantly different from zero the interpretation is herding behavior in the market.

martingale
Posts: 51
Joined: Tue Jul 24, 2012 11:36 am

Re: sample in a group

Postby martingale » Fri Jul 17, 2015 9:46 am

a solution was found , you find the research done and the programming code used in e-views here: http://brage.bibsys.no/xmlui/bitstream/ ... ilidis.pdf


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 1 guest