Simple Error Bar
Uh, no. You are forgetting to take the square root of 10, and to divide
by the square root of 12.
The variance of Y is (exactly) (56^2 - 1)/12, so the variance of Y-bar
is this quantity over 10,
so the standard deviation of Y-bar is sqrt((56^2 - 1)/12)/sqrt(10).
Which is approximately
(ignoring the -1) 56/sqrt(12) * 1/sqrt(10).
cheers,
Rolf
On 12/06/13 20:26, Jim Lemon wrote:
On 12/06/2013 04:16 PM, mohan.radhakrishnan at polarisft.com wrote:
Hi,
Basic question with basic code. I am simulating a
set of
'y' values for a standard 'x' value measurement. So here the error bars
are very long because the
number of samples are very small. Is that correct ? I am plotting the
mean
of 'y' on the 'y' axis.
Thanks,
Mohan
x<- data.frame(c(5,10,15,20,25,30,35,40,50,60))
colnames(x)<- c("x")
y<- sample(5:60,10,replace=T)
y1<- sample(5:60,10,replace=T)
y2<- sample(5:60,10,replace=T)
y3<- sample(5:60,10,replace=T)
y4<- sample(5:60,10,replace=T)
z<- data.frame(cbind(x,y,y1,y2,y3,y4))
z$mean<- apply(z[,c(2,3,4,5,6)],2,mean)
z$sd<- apply(z[,c(2,3,4,5,6)],2,sd)
z$se<- z$sd / sqrt(5)
Hi Mohan, As your samples seem to follow a discrete uniform distribution, the standard deviation is approximately the number of integers in the range (56) divided by the number of observations (10).