Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: proper use of if


From   Christopher Baum <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Re: proper use of if
Date   Wed, 17 Nov 2010 09:30:24 -0500

On Nov 17, 2010, at 2:33 AM, Nick wrote:

> If you read -help predict- you will see that it explains that -predict- also takes -if- if you wish. As you did not specify -if-, predictions were generated for the whole dataset, which people sometimes do want. So, just repeat -if isin2 == 1- on the -predict-.

A perhaps even better solution is to predict... if e(sample), as that will not only incorporate the if condition on the regression, but avoid predicting for any observations which could not be included in the estimation.

Kit

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
                              An Introduction to Stata Programming  |   http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index