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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Ignore dummy variable in predict function? |

Date |
Mon, 9 Nov 2009 23:56:42 +0100 |

<> ******* sysuse uslifeexp.dta, clear gen le_measure1=le replace le_measure1=le-5 if year<=1950 | inlist(year, 1965, 1972, 1986, 1989) gen byte measuredummy=!(le_measure1==le) regress le_measure1 year measuredummy //hibernate the dummy for later... tempvar temp clonevar `temp'=measuredummy replace measuredummy=0 predict predat0 replace measuredummy=1 predict predat1 // and back to original state.. replace measuredummy= `temp' ******* HTH Martin -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Dorothy Bridges Sent: Montag, 9. November 2009 23:28 To: statalist@hsphsun2.harvard.edu Subject: st: Ignore dummy variable in predict function? Dear Statalist: I have a dataset in which my dependent variable -- say, life expectancy, so I can use the uslifexp.dta file as an example -- is measured according to two different methods. In other words, life expectancy is measured according to method a in some years and method b in other years. Method a always yields measures that are lower than those generated with method b, though much lower varies by observation. I would like to identify the time trend in this data. Hence I regress the outcome variable on year and a dummy variable for the observations generated with method a, a la: sysuse uslifeexp.dta, clear **(Imitating my actual data) gen le_measure1=. replace le_measure1=le-5 if year<=1950 | year==1965 | year==1972 | year==1986 | year==1989 replace le_measure1=le if le_measure1==. **The regression: gen measuredummy=1 replace measuredummy=0 if le_measure1==le regress le_measure1 year measuredummy Now I would like to generate predicted values of le, **as if** all of the method-a observations had been created using method b. In other words: when I follow the regress command with "predict le_predict" and then look at "twoway (scatter le_measure1 year) (lfit le_measure1 year) (line le_predict year)", I want the le_predict line (green) to be straight. It would be something like "predict le_predict as if measuredummy==0," if such a command existed. Thank you!! D. Bridges * * 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/

**References**:**st: Ignore dummy variable in predict function?***From:*Dorothy Bridges <dbstata@gmail.com>

- Prev by Date:
**Re: st: Non-normally distributed dependent variable for Random-Intercept Model and 2SLS** - Next by Date:
**Re: st: using postfile in a loop** - Previous by thread:
**Re: st: Ignore dummy variable in predict function?** - Next by thread:
**Re: st: using postfile in a loops** - Index(es):

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