# [ncl-talk] confidence interval on a regression line

Will Hobbs Will.Hobbs at utas.edu.au
Tue May 5 15:41:23 MDT 2015

```Debasish

This is a stats issue, not an issue with NCL.

Your x points span zero; at x =  0, then yReg, yReg_1 and yReg_2 ALL equal rc at yintercept. The intersecting cones of uncertainty that you see in your plot are a correct representation of the uncertainty in rc. If you don't want them to intersect then you will need to include the uncertainty in your second estimated parameter, i.e. intercept.

Will

From: debasish mazumder <debasish at ucar.edu<mailto:debasish at ucar.edu>>
Date: Wednesday, 6 May 2015 3:57 AM
To: "ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>" <ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>>
Subject: [ncl-talk] confidence interval on a regression line

Hi All,

I am trying to plot  confidence interval on a regression line (like attached image)

I have x and y two variables.

x varies between -0.07 and 0.06
y varies between -0.8 and  0.5

I followed following steps:

step 1:  rc   = regline (x,y)

step 2: yReg = rc*x + rc at yintercept ; regression line

step 3: a = rc at rstd * 2.048 ; where t for 0.975 and 28 degrees of freedom is 2.048 [table look-up].

step 4: confidence interval  rc1 = rc+a and rc2 = rc-a

step 5: confidence interval around regression line
yReg_1 = rc1*x + rc at yintercept
yReg_2 = rc2*x + rc at yintercept

But I am not getting the expected plot. Moreover yReg_1 and yReg_2 intersect each other.
Could you please point out what I am doing wrong.

with regards
-Debasish

University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150505/5f8053b1/attachment.html
```