Let us consider a simple example of a small discrete population consisting of the first ten integers \(\{1,2,3,4,5,6,7,8,9,10\}\). It is fairly simple to calculate the mean and the standard deviation of the given example. We do that in R to refresh what we have learned so far:

population <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
mean(population)
## [1] 5.5
sd(population)
## [1] 3.02765

The population mean, denoted by \(\mu\), and the population standard deviation, denoted by \(\sigma\), is 5.5 and approximately 3.028, respectively. It is important to realize, that these parameters, the population parameters, will not change! They are fixed.

Let us now take one random sample without replacement of size \(n = 3\) from this population. Once again we apply R to do all the work, by calling the sample() function:

my_sample <- sample(x = population, size = 3)
my_sample
## [1] 4 9 7

Now, we calculate the mean and the standard deviation of the given sample. However, this time, as we refer to a particular sample, we call the statistical parameter sample statistic or if we relate to the distribution of values (elements) sample distribution. To make this more explicit, the sample mean is denominated as \(\bar x\) and the sample standard deviation as \(s\).

x_bar <- mean(my_sample)
x_bar
## [1] 6.666667
s <- sd(my_sample)
s
## [1] 2.516611

The sample mean, \(\bar x\), and the sample standard deviation, \(s\), is approximately 6.667 and 2.517, respectively. Please note, that depending on the actual elements in the sample, the sample statistics will change from sample to sample.


Citation

The E-Learning project SOGA-R was developed at the Department of Earth Sciences by Kai Hartmann, Joachim Krois and Annette Rudolph. You can reach us via mail by soga[at]zedat.fu-berlin.de.

Creative Commons License
You may use this project freely under the Creative Commons Attribution-ShareAlike 4.0 International License.

Please cite as follow: Hartmann, K., Krois, J., Rudolph, A. (2023): Statistics and Geodata Analysis using R (SOGA-R). Department of Earth Sciences, Freie Universitaet Berlin.