Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Predict Questions

From   "Justin G. Gardner" <>
Subject   st: Predict Questions
Date   Tue, 20 Mar 2007 10:03:03 -0500 (CDT)

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
Ph.D. Candidate
Department of Agriculture and Consumer Economics
University of Illinois at Urbana-Champaign
*   For searches and help try:

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