[R] sciplot question

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sun May 24 16:42:59 CEST 2009


Jarle Bjørgeengen wrote:
> 
> On May 24, 2009, at 3:34 , Frank E Harrell Jr wrote:
> 
>> Jarle Bjørgeengen wrote:
>>> Great,
>>> thanks Manuel.
>>> Just for curiosity, any particular reason you chose standard error , 
>>> and not confidence interval as the default (the naming of the 
>>> plotting functions associates closer to the confidence interval .... 
>>> ) error indication .
>>> - Jarle Bjørgeengen
>>> On May 24, 2009, at 3:02 , Manuel Morales wrote:
>>>> You define your own function for the confidence intervals. The function
>>>> needs to return the two values representing the upper and lower CI
>>>> values. So:
>>>>
>>>> qt.fun <- function(x) qt(p=.975,df=length(x)-1)*sd(x)/sqrt(length(x))
>>>> my.ci <- function(x) c(mean(x)-qt.fun(x), mean(x)+qt.fun(x))
>>
>> Minor improvement: mean(x) + qt.fun(x)*c(-1,1) but in general 
>> confidence limits should be asymmetric (a la bootstrap).
> 
> Thanks,
> 
> if the date is normally distributed , symmetric confidence interval 
> should be ok , right ?

Yes; I do see a normal distribution about once every 10 years.

> 
> When plotting the individual sample , it looks normally distributed.

An appropriate qqnorm plot is a better way to check, but often the data 
cannot tell you about the normality of themselves.   It's usually better 
to use methods (e.g., bootstrap) that do not assume normality and that 
provide skewed confidence intervals if the data are skewed.

Frank

> 
> Best regards.
> Jarle Bjørgeengen


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list