**To**:**ferret_users@xxxxxxxx****Subject**:**[ferret_users] confidence interval for a linear regression****From**:**David Wang <climater@xxxxxxxxx>**- Date: Thu, 05 Mar 2009 18:08:40 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=nwky/mPSCjLt/WykaVnkL83uc0k08vN0jyvTTWZA/m4=; b=JVpoIqNg/+R/ydf+M3KlCFJs1Dn21+k022yQ92331cq0BWN2Cn3vW/+PgHH/I6KFF0 KHPQM5QleqaGGLfW+soAmk9a5++GnF2CLnaHpW44XrE/N8RK71F2YHGtf25efp79D7C3 TILXNyCcoKiVt0Z5OAUeJHOwB7XaGdGNRvs7I=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=TM9lbryMbzZWqVAp4WJTA+WmIHyDQzJDzUS/N3tbXcHSF81xN0rg3FcNemg7b9apkI 887HSF7zKZAfQfxZWujBwaRlHcYNrx2hZcroT5RUpgh/jnHpYs75P7vnRpy72Izyyfm+ N7meAA30OY1gAOwRkMqP5BTmNlij12eLzwJig=
- Sender: owner-ferret_users@xxxxxxxx

Hi Ferreters,

I recently wanted to calculate the 95% confidence interval for a linear regression by the way of regresst.jnl, and found it's quite straightforward. There is a question on this in the archive that remains unanswered (http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2006/msg00428.html). So I put forth my two cents here risking everybody has already known it.

The idea is that 95% confidence interval is about "two sigma" (http://en.wikipedia.org/wiki/Uncertainty#Measurements). So the problem boils down to estimating the sampling standard deviation of the regression slope. Following Wilks's book (statistical methods in atmospheric science, chapter 6.2), the sampling distribution for slope is Gaussian and its sampling standard deviation is given in the equation 6.18b. In Ferret, after regresst.jnl, issue the following two commands:

let >let sigmab = ((qvar/pvar-slope*slope)/(ones[t=@sum]-2))^0.5

And the 95% error bar is 2*sigmab. If the confidence interval at a different significance level (say, 90%) is desirable, one can simply go to the lookup table for the t-test and figure out how many "sigma" s/he needs.

HTH,

D.

--

life grows, death doesn't. there is no dress rehearsal.

**Follow-Ups**:**[ferret_users] Re: confidence interval for a linear regression***From:*David Wang

- Previous by thread:
**[ferret_users] about loops and listing...** - Next by thread:
**[ferret_users] Re: confidence interval for a linear regression**

Contact Us

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement