[R] Plotting confidence bands around regression line

David Winsemius dwinsemius at comcast.net
Tue Aug 10 17:38:19 CEST 2010


On Aug 10, 2010, at 11:23 AM, Michal Figurski wrote:

> David,
>
> I may have stated my problem incorrectly - my problem is to *obtain  
> the coordinates* for confidence boundary lines. As input data I have  
> only CIs for slope and intercept.

Wouldn't you also need to specify the range over which these estimates  
might be valid and to offer the means for the X values? What level of  
R knowledge are you at? You have provided no data or code. Many R  
methods offer predict methods that return CI's.

-- 
david
>
> rms/Hmisc packages are very nice, but unfortunately they do not work  
> with Passing-Bablok nor 'nls' models.
>
> --
> Michal J. Figurski, PhD
> HUP, Pathology & Laboratory Medicine
> Biomarker Research Laboratory
> 3400 Spruce St. 7 Maloney
> Philadelphia, PA 19104
> tel. (215) 662-3413
>
> W dniu 2010-08-10 11:09, David Winsemius pisze:
>>
>> On Aug 10, 2010, at 10:56 AM, Michal Figurski wrote:
>>
>>> Dear R-helpers and graphics gurus,
>>>
>>> I have two problems with plotting confidence bands:
>>>
>>> 1. First is relatively simple. I am using the Passing-Bablok  
>>> procedure
>>> to obtain "unbiased" regression coefficients. This procedure yields
>>> the "a" & "b" coefficient values along with their confidence
>>> intervals. I then plot the raw data with the regression line, but I
>>> would like to add the confidence band for the line... and I can't
>>> figure out how to do it.
>>>
>>> In other words, given:
>>>
>>> Estimate 5%CI 95%CI
>>> Intercept -4.305562 -9.931152 -1.381792
>>> Slope 1.257318 1.053025 1.678516
>>>
>>> How to plot the regression line with confidence band?
>>
>> Take a look at plotCI in either gplots or plotrix packages.
>>
>> Harrell's rms/Hmisc packages are nicely integrated with lattice and
>> encourage you to create effective displays of models that remove
>> simplistic linearity assumptions.
>>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list