[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Predict Questions
Hello Stata List,
I have a linear model:
y= d*D + b*X
Where D is a dummy variable. Is there a simple way to generate a prediction where the dummy variable is held constant? i.e. I want to know what y would be if D was always 0, and what y would be if D was always 1.
I know that I can just type in two equations and generate two new variables, but that method is cumbersome if I have to repeat it several times.
What will happen if I use the predict command with and if statement?
reg y D X
predict <new variable name> if D=1
This method will only give me a prediction if D is actually 1? If so then that is not what I need.
Thank you for your help.
Justin G. Gardner
Department of Agriculture and Consumer Economics
University of Illinois at Urbana-Champaign
* For searches and help try: