To my surprise I learn to today that the e(sample) function when undefined evaluates to 0, and not to missing, as the following example shows:
Code:
. clear all . sysuse auto (1978 Automobile Data) . summ mpg if e(sample) Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- mpg | 0 . summ mpg if e(sample)!=. Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- mpg | 74 21.2973 5.785503 12 41 . gen e = e(sample) . summ e Variable | Obs Mean Std. Dev. Min Max -------------+--------------------------------------------------------- e | 74 0 0 0 0 . list e in 1/5 +---+ | e | |---| 1. | 0 | 2. | 0 | 3. | 0 | 4. | 0 | 5. | 0 | +---+
When I tried to find where this is explained in the manual, I am not finding anything. When I type
Code:
. help e(sample)
e(sample)
Description: 1 if the observation is in the estimation sample and 0 otherwise
Range: 0 to 1
appears.
When I follow up on see [U] 18.8 Accessing results calculated by other programs, there are some mentions of e(sample) but does not really explain how this function behaves. In particular I do not see it anywhere explained that 1) e(sample) is always defined, even if I have not estimated anything before; 2) e(sample) is equal to 0, and not to missing in this case when we have not estimated anything before.
0 Response to The e(sample) function evaluates to 0 when it is not defined (and not to missing as I expected). Where is this documented?
Post a Comment