Answers:
正如@Gschneider指出的那样,它计算样本标准偏差
您可以轻松检查以下内容:
> #generate a random vector
> x <- rnorm(n=5, mean=3, sd=1.5)
> n <- length(x)
>
> #sd in R
> sd1 <- sd(x)
>
> #self-written sd
> sd2 <- sqrt(sum((x - mean(x))^2) / (n - 1))
>
> #comparison
> c(sd1, sd2) #:-)
[1] 0.6054196 0.6054196
sd( c(-1,0,1) )
其输出1