st: AW: calculating stdp for interpolation/extrapolation

 From "Martin Weiss" To Subject st: AW: calculating stdp for interpolation/extrapolation Date Wed, 16 Sep 2009 00:00:01 +0200

```<>

If you ever wanted to recalculate the three standard errors returned by
-predict-, you could employ -mata- to see they are correct...

*************
sysuse auto, clear

reg we pr disp
gen cons=1
predict stdp, stdp
predict stdf, stdf
predict stdr, stdr

tomata cons pr di

mata
X=(cons, price , displacement)
h=diagonal(X*invsym(X'*X)*X')
stdp=st_numscalar("e(rmse)")*sqrt(h)
stdf=st_numscalar("e(rmse)")*sqrt((1:+h))
stdr=st_numscalar("e(rmse)")*sqrt((1:-h))
//last 10 rows
(stdp, stdr, stdf)[(rows(stdf)-9..rows(stdf)),.]
end

l stdp stdr stdf /*
*/ in -10/l, noo sep(0)
*************

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ariel Linden,
DrPH
Gesendet: Dienstag, 15. September 2009 19:17
An: statalist@hsphsun2.harvard.edu
Betreff: st: calculating stdp for interpolation/extrapolation

Hi All,

I would like to calculate 95% CIs for interpolating and extrapolating beyond
a range of estimated values in the data-set. I see from running "predict X,
stdp" that a different stdp is estimated for each value, but I can't figure
out how the stdp is calculated (and thus CI's).

The following excerpt from the help file does not clarify things for me:
"stdp calculates the standard error of the prediction, which can be thought
of as the standard error of the predicted expected value or mean for the
observation's covariate pattern. The standard error of the prediction is
also referred to as the standard error of the fitted value."

Ariel

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