[R] Plotting confidence bands around regression line

Michal Figurski figurski at mail.med.upenn.edu
Wed Aug 11 17:13:34 CEST 2010


Peter, Frank, David and others,

Thank you all for your ideas. I understand your lack of trust in P&B 
method. Setting that aside (it's beyond me anyways), please see below 
what I have finally came up with to calculate the CI boundaries. Given 
the slope and intercept with their 05% & 95% CIs, and a range of x = 1:50 :

    ints    = c(-1, 0, 1)      # c(int05%, int, int95%)
    slos    = c(0.9, 1, 1.1)   # c(slo05%, slo, slo95%)
    CIs     = data.frame(x=1:50, lo=NA, hi=NA)
    for (i in 1:50) {
        CIs$lo[i] = min(ints + slos * CIs$x[i])
        CIs$hi[i] = max(ints + slos * CIs$x[i])
        }

It looks like it works to me. Does it make sense?

Now, what about a 4-parameter 'nls' model? Do you guys think I could use 
the same approach?

Best regards,

--
Michal J. Figurski, PhD
HUP, Pathology & Laboratory Medicine
Biomarker Research Laboratory
3400 Spruce St. 7 Maloney
Philadelphia, PA 19104
tel. (215) 662-3413

On 2010-08-10 13:12, Peter Dalgaard wrote:
> Michal Figurski wrote:
>
>> # And the result of the Passing-Bablok regression on this data frame:
>>              Estimate      5%CI     95%CI
>> Intercept -4.306197 -9.948438 -1.374663
>> Slope      1.257584  1.052696  1.679290
>>
>> The original Passing&  Bablok article on this method has an easy
>> prescription for CIs on coefficients, so I implemented that. Now I need
>> a way to calculate CI boundaries for individual points - this may be a
>> basic handbook stuff - I just don't know it (I'm not a statistician).
>
> The answer is that you can't. You can't even do it with ordinary linear
> regression without knowing the correlation between slope and intercept.
> However, if you can get a CI for the intercept then you could subtract
> x0 from all the x and get a CI for the value at x0.
>
> (This brings echos from a distant past. My master's thesis was about
> some similar median-type estimators. I can't remember whether I looked
> at the Passing-Bablok paper at the time (1985!!) but my general
> recollection is that this group of methods is littered with unstated
> assumptions.)
>



More information about the R-help mailing list