> -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Ron Michael > Sent: Wednesday, January 16, 2008 12:15 AM > To: [EMAIL PROTECTED] > Subject: [R] Different results in calculating SD of 2 numbers > > Hi all, > > Can anyone tell me why I am getting different results in calculating SD of 2 > numbers ? > > > (1.25-0.95)/2 > [1] 0.15
Because the above is not the standard deviation of two numbers. The sample based estimate of the population standard deviation of a set of numbers (which is what sd() computes) is (sum((x-mean(x))^2 )/(length(x)-1))^.5 which for your two numbers would be ( (1.25 - 1.1)^2 + (.95 - 1.1)^2 )^.5 > > sd(c(1.25, 0.95)) > [1] 0.2121320 # why it is different from 0.15? > > Regards, > Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA ______________________________________________ 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.