Error Bars in R – find 99% CI

meanex <- mean(x5)
print("mean")
print(meanex)
SDex <- (sqrt(var(x5)))
print("SD")
print(SDex)
upperCI <- meanex +(2.58*SDex/(sqrt(length(x5))))
print("upperCI")
print(upperCI)
lowerCI <- meanex - (2.58*SDex/(sqrt(length(x5))))
print("lowerCI")
print(lowerCI)
totalCI <- upperCI - lowerCI
print("totalCI")
print(totalCI)

Transcript

Well, we can now calculate the mean of them, and you can compute the square root of the variance of them and plot the standard deviation from the expected value.

And now we can find our error bars and so 99% that corresponds to 2.58 times the standard deviation divided by the square root of the length, and now we've got our upper and lower confidence intervals.