Statalist The Stata Listserver

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

Re: st: problems with e(sample)

From   Robert A Yaffee <>
Subject   Re: st: problems with e(sample)
Date   Sat, 17 Jun 2006 00:53:00 -0400

Caveat with e(sample)
  When one is using a differenced variable, the first observation may be
included when e(sample) does not equal 0.  This may confuse the clean
between the estimation and validation sample if one is not careful.  I
to construct a segment variable dividing the estimation from the holdout
for out-of-sample forecast evaluation.
  - Regards,
     Bob Yaffee

Robert A. Yaffee, Ph.D.
Research Professor
Shirley M. Ehrenkranz
School of Social Work
New York University

home address:
Apt 19-W
2100 Linwood Ave.
Fort Lee, NJ
Phone: 201-242-3824
Fax: 201-242-3825

----- Original Message -----
From: Richard Williams <>
Date: Saturday, June 17, 2006 0:21 am
Subject: Re: st: problems with e(sample)

> At 05:33 PM 6/16/2006, Zurab Sajaia wrote:
> >I found the cause of problem, -restore- works after setting all 
> the 
> >ereturns and it clears e(sample) leaving other parameters unchanged.
> >
> >"esample(varname) specified with ereturn post or repost gives the 
> >name of the 0/1 variable indicating the observations involved in 
> the 
> >estimation.
> >The variable is removed from the data but is available for use as
> >e(sample);"
> >
> >This is what they say in the help so it's still unclear to me why 
> >e(sample) disapeares after restoring original data...
> I am not sure how e(sample) works but I have always suspected it is 
> really a variable masquerading as a function.  If not, it must 
> contain all the rules that would be needed to create such a 
> variable.  In any event, it seems to behave pretty much the same 
> way 
> as a variable - restore the data to an earlier point and variables 
> created since then (along with e(sample)) get lost too.
> I can see why it would be difficult to keep e(sample) alive after 
> doing a restore.  Suppose I preserved the data, then did a 
> collapse, 
> then did a restore.  What is e(sample) supposed to identify as 0 
> and 
> 1?  Or, suppose I preserved, gave various commands that deleted or 
> added cases, ran my command, and then restored.  How would 
> e(sample) 
> keep track of all the data commands that occurred before I ran my 
> estimation command?  Or, how about preserve, reshape, restore?
> I suppose if you really wanted/needed to keep e(sample) alive, you 
> could create and save a new dataset before you did you restore, and 
> then merge your original data set with the one that contained 
> e(sample).    Alternatively, I suppose it wouldn't be too hard to 
> figure out the commands that would generate e(sample) if you didn't 
> already have it.
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> FAX:    (574)288-4373
> HOME:   (574)289-5227
> EMAIL:  Richard.A.Williams.5@ND.Edu
> WWW (personal):
> WWW (department): 
> *
> *   For searches and help try:
> *
> *
> *
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index