7 Samples and Populations (Ch. 7)
Drennan dwells at some length on sampling because it is so fundamental in archaeology. It’s important to remember that often our most basic concern with sampling is understanding the nature of the sample we have, and how it relates to the population in which we are interested - but a much more immediate and practical concern is how to efficiently draw random samples. A simple but very powerful tool for doing this in R is sample(), which can replace the table of random numbers that Drennan discusses.
Suppose that you had gridded an area in 1 ha blocks and wanted to select a random sample of grid squares in which to collect cultural material, or crop varieties, or butterflies. If the area you were studying was 10 km x 7.5 km, you would have 7500 ha to choose from [(10000 * 7500)/10000], from which you might want to sample only 100. Perhaps the simplest way to sample these would be to assign a number to each hectare block within the grid, and then randomly select 100.
grids <- sample(1:7500, 100) #randomly select 100 numbers from 1-7500, w/o replacement
#if you have reason to sample with replacement instead, use replace = TRUE in sample()
grids #by default these are ordered as selected## [1] 7029 3678 1670 2429 893 573 1187 1369 6305 66 2434 826 3712 3060 1360
## [16] 449 4747 3561 3214 5402 2535 1586 1351 52 1480 7049 7275 3140 1216 7122
## [31] 843 6380 6378 5745 3646 3600 1556 1803 5921 4553 6431 3463 2203 4234 1753
## [46] 2972 5304 1880 1588 2608 7383 1878 3945 3977 1083 647 3685 2798 1172 3397
## [61] 5414 4544 5440 6535 3709 4655 6083 3365 5954 6614 2737 5349 3255 2248 314
## [76] 5052 6221 901 5899 1937 5844 400 4976 7044 3316 1465 6281 28 2069 653
## [91] 4689 7012 1396 6838 953 278 2550 2933 6173 3753
Probably - think about the practical realities of working your way around the landscape collecting samples - you’d find it more practical to order these sequentially.
## [1] 28 52 66 278 314 400 449 573 647 653 826 843 893 901 953
## [16] 1083 1172 1187 1216 1351 1360 1369 1396 1465 1480 1556 1586 1588 1670 1753
## [31] 1803 1878 1880 1937 2069 2203 2248 2429 2434 2535 2550 2608 2737 2798 2933
## [46] 2972 3060 3140 3214 3255 3316 3365 3397 3463 3561 3600 3646 3678 3685 3709
## [61] 3712 3753 3945 3977 4234 4544 4553 4655 4689 4747 4976 5052 5304 5349 5402
## [76] 5414 5440 5745 5844 5899 5921 5954 6083 6173 6221 6281 6305 6378 6380 6431
## [91] 6535 6614 6838 7012 7029 7044 7049 7122 7275 7383
As Drennan (p85) is at pains to point out - and as you would be very wise to note! - random is not the same thing as representative. The concepts underlying Drennan’s discussion of random and nonrandom samples, sampling bias, and representativeness are at least as important as any statistical technique. As Drennan notes (p88), these are issues fundamental to inference generally, not just to statistical inference (i.e., you cannot avoid the need to think about these issues by simply eschewing statistics!).
Note that R code that generates random samples is very unlikely to draw the same number twice! So…if you run the code a second time, you’re likely to get a different answer. If you want to, for illustrative purposes, makes sure that you always draw the same random number, use the set.seed() function.
Compare the result of running both lines of code below two or three times to the result of running only the second line of code two or three times.