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

# st: RE: Question about "predict" and "mean" when i ~= (not equal) j?

 From "Martin Weiss" To Subject st: RE: Question about "predict" and "mean" when i ~= (not equal) j? Date Tue, 24 Nov 2009 23:15:25 +0100

```<>

Look at
http://www.stata.com/support/faqs/data/members.html

Your "gap" is also known as residual, and -predict- can deliver it directly
with the -residuals- option...

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Sun, Yan (IFPRI)
Sent: Dienstag, 24. November 2009 23:06
To: statalist@hsphsun2.harvard.edu
Subject: st: Question about "predict" and "mean" when i ~= (not equal) j?

Hi, all,

Theoretically, my question is easy; but I do not know how to program it
in STATA.

Y is my dependent variable, X1, X2, X3 are my independent variable,
i/j=1, 2, ..., n are my observations, m=1, 2, ...,20 is city, my
equation is Y==X1 X2 X3. What I want to calculate is  GAP(i~=j,
m)=Predicted Y(j) for i-mean(j, m) (j is all the other observations). I
know how to do for the equation GAP(i,m)=Predicted Y(i)-mean(i,m) , in
this case, what I do is
Reg Y X1 X2 X3
Predict PY, xb
Gen gap=PY-Y
collapse gap, by(m)

But I do not know how to predict and calculate the value which does not
include the current observation (the predicted value and the mean value
which excludes the current value)?

*
*   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/
```

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