Create a group of numbers:
x <- c(7, 3, 6.2, 9, 1)
x
## [1] 7.0 3.0 6.2 9.0 1.0
Compute the calculations below.
mean(x)
## [1] 5.24
length(x)
## [1] 5
max(x)
## [1] 9
Find the Standard Deviation. The formula is: \[\sqrt{\frac{1}{N-1}\sum\limits_{i=1}^N(x_i-\bar{x})^2},\]
z={1/(5-1)}
N=5
y=mean(x)
(x-y)^2
## [1] 3.0976 5.0176 0.9216 14.1376 17.9776
sqrt(z*sum((x-y)^2))
## [1] 3.207491
The Standard Deviation above should equal the Standard Deviation when using the sd() function.
sd(x)
## [1] 3.207491
The Standard Deviation calculated using arithmetic operations equals the Standard Devation using the R command.