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] 3561 6673 3368 5106 3696 5827 785 6959 7461 4885 2868 5100 4823 780 1675
## [16] 818 4223 2806 1458 3771 2323 1303 3339 5351 5824 1429 727 946 4024 268
## [31] 6684 2963 2199 7390 3822 2662 4995 2682 5135 5648 460 6339 4590 2760 7434
## [46] 2661 2924 6851 6231 7436 1246 339 5463 5775 5224 2614 3627 5770 3470 2899
## [61] 6593 2947 771 4281 313 3473 3810 4577 4675 4085 4184 4182 6056 810 3633
## [76] 4773 4570 2835 2211 4303 2620 2875 1018 5099 3324 6086 856 6288 7209 1213
## [91] 293 5299 5819 112 7314 7037 7119 1564 7023 7111
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] 112 268 293 313 339 460 727 771 780 785 810 818 856 946 1018
## [16] 1213 1246 1303 1429 1458 1564 1675 2199 2211 2323 2614 2620 2661 2662 2682
## [31] 2760 2806 2835 2868 2875 2899 2924 2947 2963 3324 3339 3368 3470 3473 3561
## [46] 3627 3633 3696 3771 3810 3822 4024 4085 4182 4184 4223 4281 4303 4570 4577
## [61] 4590 4675 4773 4823 4885 4995 5099 5100 5106 5135 5224 5299 5351 5463 5648
## [76] 5770 5775 5819 5824 5827 6056 6086 6231 6288 6339 6593 6673 6684 6851 6959
## [91] 7023 7037 7111 7119 7209 7314 7390 7434 7436 7461
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.