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 <bob.yaffee@nyu.edu>
To   statalist@hsphsun2.harvard.edu
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
division
between the estimation and validation sample if one is not careful.  I
prefer
to construct a segment variable dividing the estimation from the holdout
sample
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
07024-3171
Phone: 201-242-3824
Fax: 201-242-3825
yaffee@nyu.edu

----- Original Message -----
From: Richard Williams <Richard.A.Williams.5@ND.edu>
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):    http://www.nd.edu/~rwilliam
> WWW (department):    http://www.nd.edu/~soc 
> 
> *
> *   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