Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: CIs around Qreg trend line
From
"Nick Cox" <[email protected]>
To
<[email protected]>
Subject
RE: st: CIs around Qreg trend line
Date
Tue, 16 Mar 2010 21:32:38 -0000
(100 - 95) / 200 is .025 as I presume you know or can work out for
yourself.
The result is put in a local macro called -level- which is then fed as
one argument to the -invttail()- function. In this case, you get a 95%
confidence interval. The other argument is the number of residual
degrees of freedom to play with. The element "df" is a clue here.
To get this example, I modified some code that you can see for a similar
problem in
. ssc type rcspline.ado
I use this form because it is then easy to see that for "different
values of 95", you would just plug in something else instead of 95, e.g.
local level = (100 - 90) / 200
is the different line needed for a 90% confidence interval.
Nick
[email protected]
Jeffrey B. Wolpin
Thank you. The example syntax worked great.
Question:
What is being computed by the line "local level = (100 - 95) / 200"?
Is this line in any way dependent upon the number of observations?
Alternatively, what does 200 signify.
Nick Cox
sysuse auto, clear
gen gpm = 1/mpg
qreg gpm weight
predict pred
predict se, stdp
local level = (100 - 95) / 200
gen ul = pred + invttail(e(df_r), `level') * se
gen ll = pred - invttail(e(df_r), `level') * se
twoway rarea ll ul weight, sort astyle(ci) || ///
line pred weight, sort || ///
scatter gpm weight, legend(off) ytitle(Gallons per mile)
Jeffrey B. Wolpin
In Stata 10, assuming a qreg regression with one predictor, is there a
way to develop confidence intervals around the qreg trend line (or any
quantile for that matter)?
Also, once developed, what would be the syntax to then graph the scatter
plot, trend line and confidence intervals?
*
* 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/