Statalist


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

st: AW: calculating stdp for interpolation/extrapolation


From   "Ariel Linden, DrPH" <[email protected]>
To   [email protected]
Subject   st: AW: calculating stdp for interpolation/extrapolation
Date   Wed, 16 Sep 2009 11:22:08 -0400

Hi Martin,

Thank you for your response. I assume you are referring to the manuals where
you see the formulas for the STDP, STDF, and STDR? I am traveling and don't
have access to them, so I am looking to the help files loaded with Stata
(v10.1).

Given that I am trying to interpolate to values within the range (but not
necessarily available in the dataset), it appears that I will either need to
manually calculate the STDP (or STDF), or take the STDF from a value close
to that which I want to build a CI around?

I cannot interpret the MATA code below to know how to calculate this
manually. Could you please provide an example (perhaps with the auto data
using price = Y and weight = X)?

Thank you again for your guidance.

Ariel


Date: Wed, 16 Sep 2009 00:00:01 +0200
From: "Martin Weiss" <[email protected]>
Subject: st: AW: calculating stdp for interpolation/extrapolation

<> 

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



*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index