Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: sample splitting problem


From   "Sergio Correia" <sergio.correia@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: sample splitting problem
Date   Wed, 21 Nov 2007 01:26:38 -0500

Probably the simplest thing is to collapse the dataset and then
obtaining the median. Something like this (change the varnames where
appropiate):

preserve
gen ratio = x/y
collapse ratio, by(firm)
su ratio, detail
local threshold = r(p50)
restore

gen more_x = (x/y > `threshold')

In the end, we restore the data and create a dummy variable that
indicates whether each firm has more of x or not (not having more of x
is the same as having more of y).

HTH,
Sergio

PS: I'm assuming your panel is in -long- format. If not, set it as long.

On 21 Nov 2007 06:00:21 -0000,  <dist@interfree.it> wrote:
> Dear all, here I'm again for a new request of help. I would like to replicate a sample splitting into my research.
> Given an unbalanced panel (ts-cs data) and two variables, x and y, the sample splitting criterion is the following:
> a firm is identified as having more "x" (high_x) if "x/y" is larger than the median accross firms of the firms' time averages. Conversely, a firm is identified as having less "x" (low_x) if "x/y" is less than (or equal to) the median accross firms of these time averages. I would be grateful if someone can help me with the commands (just an example to use for my dataset).
>
> Thank you very much.
>
>
>
> (I'm sending this message again, since the first one - from another email - never appeared into the list)
>
> ----------------------------------------------------------------------------
> DEXGATEMICRO il centralino VoIP multifunzione per l'azienda.
> Prova gratuita per 4 utenti!
>
>
> Scopri tutte le funzionalita' sul sito Dexgate.com
> ----------------------------------------------------------------------------
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index