confused about std dev I'm working on a project that involves some statistics: I need to obtain the standard deviation from a set of numbers.
I've obtained two different results from the following:

*

*Calculating sample std dev manually using the formula, or calculating it in Excel using the STDEV function - obtained the same result with both

*Plotting the numbers into a Shewhart individual/moving range control chart in R, using library(qcc) - obtained a different value for std dev compared to the above.

Does anyone know why these might be different?
Thank you!

 A: Comment continued: Consider normal samples with $n=5.$
Divide sample range by 2.326 for unbiased estimate of $\sigma.$
set.seed(2021)
rge = replicate(10^6, diff(range(rnorm(5))))
mean(rge)
[1] 2.325985

So divide sample range by 2.326 for estimate of $\sigma=1.$
set.seed(2021)
rge.adj = replicate(10^6, diff(range(rnorm(5)))/2.326)
mean(rge.adj)
[1] 0.9999936   # very nearly 1

Sample standard deviations tend to underestimate population $\sigma,$ especially for small $n.$
set.seed(2021)
s = replicate(10^6, sd(rnorm(5)))
mean(s)
[1] 0.9401148   # downward bias


For $n=6$ (different seeds)
set.seed(2021)
rge = replicate(10^6, diff(range(rnorm(6))))
div = mean(rge);  div
[1] 2.534639

set.seed(213)
rge.adj = replicate(10^6, diff(range(rnorm(6)))/div)
mean(rge.adj)
[1] 0.9994023   # pop SD well estimated by adjusted range

set.seed(1234)
s = replicate(10^6, sd(rnorm(6)))
mean(s)
[1] 0.9517331   # pop SD underestimated by sample SD

Furthermore, the adjusted range has a noticeably smaller root mean square error for $n$ as small as $6:$
sqrt(mean(s - 1)^2)     # RMSE of sample SD
[1] 0.03471834
sqrt(mean(rge.adj-1)^2) # RMSE of adjusted range
[1] 0.0007772492        # smaller

