Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Clustering by school year


From   Stas Kolenikov <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Clustering by school year
Date   Sun, 24 Oct 2010 09:19:04 -0500

On Sat, Oct 23, 2010 at 9:39 PM, David Kantor <kantor.d@att.net> wrote:
>> Would clustering by school year be as simple as generating a variable
>> school_year = school identifier * year, and then using this new varialbe as
>> the cluster?
> P.S., there is another numeric-based solution: either,
>  k1 * school_identifier + year
> or
>  k2 * year + school_identifier
>
> where k1 or k2 are strategically chosen constants:
>  k1 > max(year)
>  k2 > max(school_identifier)
>
> One possibility is
>  10000 * school_identifier + year

This may run into numeric accuracy problems unless the type is
declared as -long-. A more natural solution is i.school##i.year in
terms of Stata factor variables, or old-fashioned xi: i.school*i.year.

-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index