Page 1 of 1

Confidence Intervals

Posted: Sat May 31, 2008 8:59 am
by bkoksal
How do we get confidence intervals after the regressions? Thanks for any help.

Re: Confidence Intervals

Posted: Tue Jun 03, 2008 10:01 am
by TomDoan
bkoksal wrote:How do we get confidence intervals after the regressions? Thanks for any help.
This is probably overkill, but if you use this procedure, using

@RegConfidence

after a regression, you'll get a table with the confidence bands. If you're interested in a single coefficient, you can use %beta(i) and %stderrs(i) to construct this. For instance, a 2 standard error band for coefficient 3 is
%beta(3)-2*%stderrs(3) to %beta(3)-2*%stderrs(3)

Code: Select all

*
* @RegConfidence(options)
* Regression post-processor to show table of confidence intervals for coefficients
*
* Options:
*   CONFIDENCE=confidence level[.95]
*   STDERRS=number of standard errors [not used]
*
* If you use STDERRS (for instance, STDERRS=2), you will get that specific
* multiple of standard errors +/- for the bounds. Otherwise, the value of the
* CONFIDENCE option will be used with the current degrees of freedom to determine
* the multiple.
*
* Revision Schedule:
*  06/2008 Written by Tom Doan, Estima
*
procedure RegConfidence
option real confidence .95
option real stderrs
*
local real k
local integer i
*
if %defined(stderrs)
   compute k=stderrs
else
   compute k=%invttest(1-confidence,%ndf)

report(action=define)
report(atrow=1,atcol=1) "Label"
report(atrow=1,atcol=2,align=center) "Coefficient" "Lower" "Upper"
do i=1,%nreg
   report(atrow=i+1,atcol=1) %eqnreglabels(0)(i) %beta(i) $
      %beta(i)-k*%stderrs(i) %beta(i)+k*%stderrs(i)
end do i
report(atcol=2,tocol=4,action=format,width=9)
report(action=show)
end