Page 1 of 2

Creating dummies that vary over time and across funds

Posted: Tue May 08, 2012 12:45 pm
by lb85
Hello,

I have an unbalanced panel data set of 1381 funds over 145 months and I'll run a regression with monthly net flows as dependent variable and lagged monthly returns as independent variable (plus some control variables). I have two (related) questions regarding dummy creation (in Eviews 6 student version):

1) For the descriptive statistics part I'd like to do a univariate analysis of e.g. the independent variable ln_return and check whether the mean of returns below the median is significantly different from those above the median. I know that you can do this by "Equality Tests by Classification" and insert a dummy but I wonder how to create this dummy.
If I use something like "series dummy_median=@recode(ln_return<median(ln_return),0,1)" does it take all monthly returns (no matter in which month or for which fund), calculate the median and then assign the dummy as to whether the return is below or above this median?

2) This leads me to the second question: As I'd like to use a piecewise regression later on with the ln_return split into quartiles, I need to create a dummy variable for each quartile with for instance dummy Q1 taking the value 1 if the fund's return in a specific month is above the 75th of all funds in the cross-section in existence in this month and 0 otherwise. How can I create such a dummy that is varying over cross-section and over time-series?

Many thanks for your help and please let me know if you need additional information.

Cheers, LB

Re: Creating dummies that vary over time and across funds

Posted: Thu May 10, 2012 2:01 am
by lb85
Hi Eviews moderators..

I'd really appreciate your help regarding my question above as I'm stuck right now.

Many thanks in advance.

Re: Creating dummies that vary over time and across funds

Posted: Thu May 10, 2012 7:43 am
by EViews Gareth
1) Yes.
2) Use the @mediansby function to create median values by time (entering @month, @year as the by variables), or by cross-section (entering @crossid as the by variable).

Re: Creating dummies that vary over time and across funds

Posted: Thu May 10, 2012 8:54 am
by lb85
Hi Gareth

Many thanks for your reply.

I started with the function in 1. and a pop-up window said that "median" is not defined. What is the exact function I need to use to calculate the median as described in 1. ? Isn't there a function to calculate this similar as calculating a log by just typing log(x)?

Thanks, lb

Re: Creating dummies that vary over time and across funds

Posted: Thu May 10, 2012 9:02 am
by EViews Gareth
@median

Re: Creating dummies that vary over time and across funds

Posted: Sat May 26, 2012 9:13 am
by lb85
Hi Gareth

The dummy creation worked fine but now I'd need your help on the following:

For the same panel, I need to assign percentile ranks to the variable ln_return. In particular, I'd like to create a new series that instead of the ln_return states the percentile rank for the fund compared to its cross section and this for every month. The percentile ranking should take values between 0 and 1.

Is there something like @ranksby or do you have any other idea?

I need the ranks to then split the variable ln_return into quintiles and run a piecewise linear regression.

Thanks again for the help,
lb85

Re: Creating dummies that vary over time and across funds

Posted: Sat May 26, 2012 3:12 pm
by EViews Gareth
There's no function built in that will do that.

Re: Creating dummies that vary over time and across funds

Posted: Sun Jun 03, 2012 6:37 am
by lb85
Isn't there a way to normalize a return series (stacked data) to a series that takes values between 0 and 1?

In Excel, I would calculate the following for each a cross section:

To get rid of the negative values:
abs_series = return_series+abs(min(return_series))

To get values between 0 and 1:
rank_series = abs_series-min(abs_series)/max(abs_series)-min(abs_series)

But as I have a panel data set, it should apply the values between 0 and 1 grouped by period and not for all the values in the return series.
How could I implement this in Eviews 6?

Re: Creating dummies that vary over time and across funds

Posted: Sun Jun 03, 2012 10:09 am
by EViews Gareth
Use the @minsby and @maxsby with "@crossid" as the by variable.

Re: Creating dummies that vary over time and across funds

Posted: Mon Jun 04, 2012 5:41 am
by lb85
Hi Gareth

Thanks for your help. I was able to create a new series that contains ranks (from 0 to 1) named ranks_ret instead of the return.The next step is to split this series into quintiles which I thought is rather simple.

For example, to calculate the quintile 1-3 I did:
Quintile_1_ranks=@min(0.2,ranks_ret)
Quintile_2_ranks=@min(0.2,ranks_ret-quintile_1_ranks)
Quintile_3_ranks=@min(0.2,ranks_ret-(quintile_1_ranks+quintile_2_ranks))
...

However, I'm not able to create these new series. It always returns the following error message "Error in Sample: Illegal date ranks_ret"

Could I share the file with you?

Re: Creating dummies that vary over time and across funds

Posted: Mon Jun 04, 2012 7:53 am
by EViews Gareth
What are you trying to do with the line:

Code: Select all

Quintile_1_ranks=@min(0.2,ranks_ret)

Re: Creating dummies that vary over time and across funds

Posted: Mon Jun 04, 2012 10:23 am
by lb85
Series quintile_1_ranks should take the value from the series ranks_ret if it is below 0.2 or 0.2 else and so on...
Please find attached an example of how the values should be in each quintile.

Re: Creating dummies that vary over time and across funds

Posted: Mon Jun 04, 2012 11:24 am
by EViews Gareth

Code: Select all

series quantile_1_ranks = @recode(ranks_ret<0.2, ranks_ret, 0.2)

Re: Creating dummies that vary over time and across funds

Posted: Mon Jun 04, 2012 11:26 am
by lb85
Thanks Gareth, that's what I did as well, but I just wonder why it's not working with the @min function...

Re: Creating dummies that vary over time and across funds

Posted: Mon Jun 04, 2012 11:41 am
by EViews Gareth
Because the @min function doesn't find the minimum of two series. It find the minimum of a single series (through time/observations).