Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Sorting data in deciles and then regressing and storing coefficients. (Looping)


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Sorting data in deciles and then regressing and storing coefficients. (Looping)
Date   Wed, 10 Jul 2013 14:33:46 +0100

Chris Evans:

You often, indeed usually, employ the incorrect name "Satalist" in
postings. Why on earth? If the reason is only that you don't check
your posts carefully, it doesn't encourage careful attention to your
questions.

The -egen- function -xtile()- is user-written and to be found in the
package -egenmore- (SSC). The Statalist FAQ explains that you should
tell us where user-written programs you use come from.

Yet further advice you are ignoring is to edit posts so that only the
important part remains.

That aside, the command

bysort year size: egen portfolio = xtile(size), nq(10)

makes no sense. Within groups defined by distinct values of -size-,
-size- is necessarily constant and there is no point to a
quantile-based subdivision. You might as well say: give me all the
deciles of 42. Answer: they are all 42.

I don't know what -sample()- refers to.

Nick
[email protected]


On 10 July 2013 13:59, C. Evans <[email protected]> wrote:
> Dear Satalist
>
> Yes I think you understand it correctly. The problems you have identified
> are the problems I was having conceptually. Yet stata command wise I was
> even struggling with creating these portfolios (remembering I am trying to
> create new portfolios every year dependent on the variable size). The code I
> tried to use was:
>
> bysort year size: egen portfolio = xtile(size), nq(10)
>
> this brings up the error value "too many variables" Is there a way around
> this? I was thinking of -sample()- do you know if this is the only option I
> have at this point to create the portfolios?
>
>
> Thanks for your consideration,
> Chris
>
> On Jul 9 2013, Jeph Herrin wrote:
>
>> So if I understand this model
>>
>>     R = constant + beta*RM
>>
>> it is estimated using all the stocks in the portfolio? in which case it
>> doesn't make sense that R is constant for that portfolio, as you suggest. On
>> the other hand, if the model is estimated using the 10 portfolios as
>> observations, it's not clear how RM is constructed for each portfolio.
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index