Suppose I've run the following regression on the auto database
I understand that
will give me the average predicted price treating every car as domestic and treating every car as foreign. What I hope to be able to get, however, is two predictions for each observation, as if it were domestic and as if it were foreign. Something like:
Unfortunately, the "asif" option doesn't seem to actually exist...
Have I overlooked a way to do this? Thank you for any suggestions.
Code:
regress price i.foreign##c.mpg
Code:
margins, at(foreign=(0 1)) //or equally well margins foreign
Code:
predict xb_domestic_hat, xb asif(foreign=0) predict xb_foreign_hat, xb asif(foreign=1)
Have I overlooked a way to do this? Thank you for any suggestions.
Comment