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]

From |
Jaime Laird <jmc981@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Last estimates not found error |

Date |
Thu, 16 Feb 2012 10:59:39 -0600 |

Austin, Thank you for your reply! Yes, I was under that impresssion. I am so glad you pointed this out. I am very new to Stata and have worked through the book "Data Analysis Using Stata" and read tons of info online but I am still not clear on a lot of things. I recognize the forv and foreach commands but am not familiar with most of what you coded so I will need to research what those commands mean and do. However, I did try your code and got the same error. I deleted all prior residuals I had saved in my data before running it since they are probably all incorrect. I feel like my mind is going explode :) forv y=1995/2009 { 2. if `y'<2000 loc yr=substr("`y'",3,2) 3. else loc yr `y' 4. qui levelsof twodigit if !mi(rd`yr'), loc(ts) 5. qui g double resremRD`yr'=. 6. foreach t of loc ts { 7. cap reg rd`yr' a`yr' mv`yr' q`yr' int`yr' lagrd`yr > ' if twodigit==`t', 8. vce(robust) 9. if _rc==0 { 10. predict e if e(sample), residuals 11. replace resremRD`yr'=e if !mi(e) 12. drop e 13. } 14. } 15. } last estimation result not found r(301); . On Feb 16, 2012, at 10:40 AM, Austin Nichols wrote: > Jaime Laird <jmc981@gmail.com>: > Are you under the impression you are getting residuals by year and > twodigit with that code? You are not. The by: construct runs all > regressions, then -predict- generates residuals based on the last > model estimated, i.e. the highest value of twodigit. If the regression > fails for the highest value of twodigit, you will get an error when > you try to predict. You need to > > forv y=1995/2009 { > if `y'<2000 loc yr=substr("`y'",3,2) > else loc yr `y' > qui levelsof twodigit if !mi(rd`yr'), loc(ts) > qui g double resremRD`yr'=. > foreach t of loc ts { > cap reg rd`yr' a`yr' mv`yr' q`yr' int`yr' lagrd`yr' if twodigit==`t', > vce(robust) > if _rc==0 { > predict e if e(sample), residuals > replace resremRD`yr'=e if !mi(e) > drop e > } > } > } > > or somesuch. > > On Thu, Feb 16, 2012 at 1:56 AM, Jaime Laird <jmc981@gmail.com> wrote: >> Hello, >> >> I am new to Stata but I have encountered a strange problem. Last night I ran the following commands: >> >> by twodigit, sort : regress rd95 a95 mv95 q95 int95 lagrd95, vce(robust) >> predict resremRD95, residuals >> by twodigit, sort : regress rd96 a96 mv96 q96 int96 lagrd96, vce(robust) >> predict resremRD96, residuals >> by twodigit, sort : regress rd97 a97 mv97 q97 int97 lagrd97, vce(robust) >> predict resremRD97, residuals >> by twodigit, sort : regress rd98 a98 mv98 q98 int98 lagrd98, vce(robust) >> predict resremRD98, residuals >> by twodigit, sort : regress rd99 a99 mv99 q99 int99 lagrd99, vce(robust) >> predict resremRD99, residuals >> by twodigit, sort : regress rd2000 a2000 mv2000 q2000 int2000 lagrd2000, vce(robust) >> predict resremRD2000, residuals >> by twodigit, sort : regress rd2001 a2001 mv2001 q2001 int2001 lagrd2001, vce(robust) >> predict resremRD2001, residuals >> by twodigit, sort : regress rd2002 a2002 mv2002 q2002 int2002 lagrd2002, vce(robust) >> predict resremRD2002, residuals >> by twodigit, sort : regress rd2003 a2003 mv2003 q2003 int2003 lagrd2003, vce(robust) >> predict resremRD2003, residuals >> by twodigit, sort : regress rd2004 a2004 mv2004 q2004 int2004 lagrd2004, vce(robust) >> predict resremRD2004, residuals >> by twodigit, sort : regress rd2005 a2005 mv2005 q2005 int2005 lagrd2005, vce(robust) >> predict resremRD2005, residuals >> by twodigit, sort : regress rd2006 a2006 mv2006 q2006 int2006 lagrd2006, vce(robust) >> predict resremRD2006, residuals >> by twodigit, sort : regress rd2007 a2007 mv2007 q2007 int2007 lagrd2007, vce(robust) >> predict resremRD2007, residuals >> by twodigit, sort : regress rd2008 a2008 mv2008 q2008 int2008 lagrd2008, vce(robust) >> predict resremRD2008, residuals >> by twodigit, sort : regress rd2009 a2009 mv2009 q2009 int2009 lagrd2009, vce(robust) >> predict resremRD2009, residuals >> >> >> When Stata got to the last two (2008 and 2009) it kept returning the error "last estimates not found" >> I went to bed and when I got up this morning there was an update for Stata available. I installed the update and then re-ran the code. All worked fine. I had the same sets of code for 4 different sets of residuals I was trying to create and all ran until the last one and it is now stuck on 2008 and 2009 like the above code was. Here is the code that is stuck now: >> >> by twodigit, sort : regress gain95 a95 mv95 q95 int95 asales95 isales95, vce(robust) >> predict resremGAIN95, residuals >> by twodigit, sort : regress gain96 a96 mv96 q96 int96 asales96 isales96, vce(robust) >> predict resremGAIN96, residuals >> by twodigit, sort : regress gain97 a97 mv97 q97 int97 asales97 isales97, vce(robust) >> predict resremGAIN97, residuals >> by twodigit, sort : regress gain98 a98 mv98 q98 int98 asales98 isales98, vce(robust) >> predict resremGAIN98, residuals >> by twodigit, sort : regress gain99 a99 mv99 q99 int99 asales99 isales99, vce(robust) >> predict resremGAIN99, residuals >> by twodigit, sort : regress gain2000 a2000 mv2000 q2000 int2000 asales2000 isales2000, vce(robust) >> predict resremGAIN2000, residuals >> by twodigit, sort : regress gain2001 a2001 mv2001 q2001 int2001 asales2001 isales2001, vce(robust) >> predict resremGAIN2001, residuals >> by twodigit, sort : regress gain2002 a2002 mv2002 q2002 int2002 asales2002 isales2002, vce(robust) >> predict resremGAIN2002, residuals >> by twodigit, sort : regress gain2003 a2003 mv2003 q2003 int2003 asales2003 isales2003, vce(robust) >> predict resremGAIN2003, residuals >> by twodigit, sort : regress gain2004 a2004 mv2004 q2004 int2004 asales2004 isales2004, vce(robust) >> predict resremGAIN2004, residuals >> by twodigit, sort : regress gain2005 a2005 mv2005 q2005 int2005 asales2005 isales2005, vce(robust) >> predict resremGAIN2005, residuals >> by twodigit, sort : regress gain2006 a2006 mv2006 q2006 int2006 asales2006 isales2006, vce(robust) >> predict resremGAIN2006, residuals >> by twodigit, sort : regress gain2007 a2007 mv2007 q2007 int2007 asales2007 isales2007, vce(robust) >> predict resremGAIN2007, residuals >> by twodigit, sort : regress gain2008 a2008 mv2008 q2008 int2008 asales2008 isales2008, vce(robust) >> predict resremGAIN2008, residuals >> by twodigit, sort : regress gain2009 a2009 mv2009 q2009 int2009 asales2009 isales2009, vce(robust) >> predict resremGAIN2009, residuals >> >> I don't think the code or my data is the problem because I didn't change anything other than the update before getting the "rd" set to finish. >> I have also ran the regression and am able to see the results in the command window but when I try to predict and get the residuals it gives the error. >> I am wondering if anyone else has had this problem or may know of a solution. >> Any feedback is appreciated. > > * > * 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/ * * 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/

**Follow-Ups**:**Re: st: Last estimates not found error***From:*Austin Nichols <austinnichols@gmail.com>

**References**:**st: Last estimates not found error***From:*Jaime Laird <jmc981@gmail.com>

**Re: st: Last estimates not found error***From:*Austin Nichols <austinnichols@gmail.com>

- Prev by Date:
**Re: st: Last estimates not found error** - Next by Date:
**st: Date: Thu, 16 Feb 2012 17:39:38 +0000** - Previous by thread:
**Re: st: Last estimates not found error** - Next by thread:
**Re: st: Last estimates not found error** - Index(es):