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]
what is -group()-? [Was: Re: st: Extract and save R2 as a variable from looping regressions]
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
what is -group()-? [Was: Re: st: Extract and save R2 as a variable from looping regressions]
Date
Thu, 24 Oct 2013 18:50:51 +0100
I needed to unearth some old manuals to be sure of this.
-group()- is now, and long has been, an undocumented function.
In ancient manuals, -group()- is explained as producing as nearly
equal-sized subsamples as possible. Its operation is seen at its
simplest like this:
. clear
. set obs 10
obs was 0, now 10
. gen group = group(2)
. l
+-------+
| group |
|-------|
1. | 1 |
2. | 1 |
3. | 1 |
4. | 1 |
5. | 1 |
|-------|
6. | 2 |
7. | 2 |
8. | 2 |
9. | 2 |
10. | 2 |
+-------+
What it does when given e.g. a variable as argument was not
documented, so far as I can find out.
Nick
[email protected]
On 1 October 2013 18:23, Robert Picard <[email protected]> wrote:
>> . gen gr_compIDmofd=group (companyID mofd)
>>
>> is illegal. You must have used -egen-
>
> Curiously, using -group()- with -generate- does not throw an error but
> I have no idea what it's supposed to do. I can't find anything in the
> help files about it either.
>
> sysuse auto
> gen g = group(turn)
>
> Does anyone know what it does?
>
> Robert
>
> *
> * 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/
*
* 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/