Dear R ussers,

I noticed a small problem when ussing for example the function " 
plotMeamns "under Rcmdr.
In this case a graph will be ploted, giving the means on the Y-axis, by a 
factor on the X-axis.
All is correct when doing this, ussing 'sd' for error bars.

The problem occures when ussing conidence intervals for error bars.
Here, R will assume that every factor on the X-axis has the same length.
And will calculate the confidence interval as folows:

    N <- length ( X)
    means  <- mean ( X, na.rm=T)
    if (is.matrix ( X))
        apply( X, 2, sd, na.rm = T)
    else if ( is.vector( X))
       qt( 0.975, df=N-1)*( sd( X, na.rm = T)/ sqrt( N))
    else if ( is.data.frame(X))
         qt( 0.975, df=N-1)*(( sapply( X, sd, na.rm = T)) /sqrt( N))
    else qt( 0.975, df=N-1)*( sd( as.vector(X), na.rm = T)) /sqrt( N)
yrange <- if (error.bars != "none")
            c(min(means - sds, na.rm=TRUE), max(means + sds ,na.rm=TRUE))

Now this works fine when you have a we equilibrated data set, yet in most 
cases you don't!
Still R will calculate the confidence intevals for each means par factor, 
ussing the length of the greatest factor.
example:
        when you have 3 factors, A with 10 mesurements, B with 5, and C 
with 8,
        all confidence intervals will be calculated ussing a total N of 10

I would like to correct this, so the plots i creat have corret CI 
errorbars, yet i did not find a procedure to omint NA's in the function " 
length ", "NROW", or "nrow".
Can anybody help me solve this problem please.

Kind regards,
Tom




Disclaimer: click here
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to