Quantitative Archaeology

=Digging Numbers=

This section includes replicas of Section 3 from the paper book "Digging Numbers" (Fletcher and Lock 1991), an introduction to elementary statistics for archaeologists. It's meant to provide practical examples using the R free software instead of proprietary statistical suites used in the book.

Data description
To read data from the raw data file into R:

spearhead <- read.csv("spearhead.csv", header=TRUE, sep=";")

From that moment on you can access the dataset with the data frame object "spearhead". The recommended way to do so is to create a new empty directory (named something like "Digging Numbers" and start R from the command line into that directory. This way, data and command history will be saved just for this workspace. You can save time and fingers with

attach(spearhead)

every time you start a new session into that workspace. This enables you to call variables directly, like Maxle instead of spearhead$Maxle

Transforming variables
To group the variable Date into a new variable Period:

Period <- Date Period[(Date>650)&(Date<=1200)] <- 1 Period[(Date>100)&(Date<=650)] <- 2 Period[(Date<=100)] <- 3 table(Period) Period 1 2  3  20 18  2  barplot(table(Period)) barplot(table(Mat,Period), beside=TRUE)

To create the new variable "maximum length / maximum width ratio", Lewirat:

Lewirat <- Maxle/Maxwi

To create the new variable "socket length as percentage of maximum length", Socperc:

Socperc <- (Socle/Maxle)*100

Tables
The straight way to get a table for your variable is the table command:

table(Cond)

If you want to have a contingency table (one variable against one other), you just have to add it between the parentheses, with the independent variable as first argument:

table(Mat,Cond)

Pictorial displays
Barchart for condition:

barplot(table(Cond)) barplot(table(Mat,Cond), beside=FALSE) barplot(table(Mat,Cond), beside=TRUE)

Histogram for socket length:

hist(Socle, freq=TRUE)

Boxplot for socket length:

boxplot(Socle)

Stem-and-leaf plot for socket length:

stem(Socle)

Scatterplot for socket length:

plot(Maxwi,Maxle, col=Mat, pch=Mat)

Measures of position and variability
To produce the mean, median, minimum, maximum values, 1st and 3rd quartiles for maximum length, use

summary(Maxle)

To calculate the standard deviation for a variable:

sd(Maxle, na.rm=TRUE)

The na.rm=TRUE parameter is necessary because we have missing values in our measurements.

To produce a boxplot for maximum length:

boxplot(Maxle)

As above but for each material:

tapply(Maxle,Mat,summary) boxplot(split(Maxle,Mat)) tapply(Maxle,Mat,sd,na.rm=TRUE)

Sampling
To take a simple 25% random sample of weight and calculate descriptive statistics of the sample:

WeightSample <- sample(Weight,10)

To see differences between the sample and the population:

summary(WeightSample) summary(Weight)