Menale Kassie wrote:
Why the mean predicted values (exphat) from OLS
regression indicated below is the same as the mean of
the observed value of the dependent variable
(lncvrpha)? I appreciate any help on this.
reg lnvcrpha lnareaha slopposn2-slopposn4 sldept if
dsttr ==1, cluster(hhcode)
predict exphat if dsttr ==0 & e(sample)
--------------------------------------------------------------------------------
There are reasons why this happens. In your particular case, you might want
to post more of what you did, using the actual code that you used: the code
that you show will give missing values for all exphat.
Also, it would be better if you snipped the post that you're replying to if
you're starting a new thread.
Joseph Coveney
. sysuse auto
(1978 Automobile Data)
. regress price weight if foreign == "Domestic":origin, noheader
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
weight | 2.994814 .4662321 6.42 0.000 2.058359
3.931268
_cons | -3861.719 1579.522 -2.44
0.018 -7034.282 -689.1562
------------------------------------------------------------------------------
. predict price_hat if foreign == "Foreign":origin & e(sample), xb
(74 missing values generated)
. assert mi(price_hat)
. drop price_hat
. quietly regress price foreign
. predict price_hat, xb
. tabulate price_hat
Linear |
prediction | Freq. Percent Cum.
------------+-----------------------------------
6072.423 | 52 70.27 70.27
6384.682 | 22 29.73 100.00
------------+-----------------------------------
Total | 74 100.00
. table foreign, contents(mean price) format(%8.3f)
-----------------------
Car type | mean(price)
----------+------------
Domestic | 6072.423
Foreign | 6384.682
-----------------------
.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/