permTest: Random mark permutation test for SPDs

Description Usage Arguments Details Value References Examples

View source: R/tests.R

Description

Global and local significance test for comparing shapes of multiple SPDs using random permutations.

Usage

1
2
3
permTest(x, marks, timeRange, nsim, bins = NA, runm = NA,
  datenormalised = FALSE, spdnormalised = FALSE, raw = FALSE,
  verbose = TRUE)

Arguments

x

A CalDates class object containing the calibrated radiocarbon dates.

marks

A numerical or character vector containing the marks associated to each radiocarbon date.

timeRange

A vector of length 2 indicating the start and end date of the analysis in cal BP.

nsim

Number of random permutations

bins

A vector indicating which bin each radiocarbon date is assigned to.

runm

A number indicating the window size of the moving average to smooth the SPD. If set to NA no moving average is applied.Default is NA.

datenormalised

If set to TRUE the total probability mass of each calibrated date will be made to sum to unity (the default in most radiocarbon calibration software). This argument will only have an effect if the dates in x were calibrated without normalisation (via normalised=FALSE in the calibrate function), in which case setting datenormalised=TRUE here will rescale each dates probability mass to sum to unity before aggregating the dates, while setting datenormalised=FALSE will ensure unnormalised dates are used for both observed and simulated SPDs. Default is FALSE.

spdnormalised

A logical variable indicating whether the total probability mass of the SPD is normalised to sum to unity.

raw

A logical variable indicating whether all permuted SPDs should be returned or not. Default is FALSE.

verbose

A logical variable indicating whether extra information on progress should be reported. Default is TRUE.

Details

The function generates a distribution of expected SPDs by randomly shuffling the marks assigned to each bin (see spd for details on binning). The resulting distribution of probabilities for each mark (i.e. group of dates) for each calendar year is z-transformed, and a 95% simulation envelope is computed. Local significant departures are defined as instances where the observed SPD (which is also z-transformed) is outside such envelope. A global significance is also computed by comparing the total "area" outside the simulation envelope in the observed and simulated data.

Value

An object of class SpdPermTest with the following elements

References

Crema, E.R., Habu, J., Kobayashi, K., Madella, M., (2016). Summed Probability Distribution of 14 C Dates Suggests Regional Divergences in the Population Dynamics of the Jomon Period in Eastern Japan. PLOS ONE 11, e0154809. doi:10.1371/journal.pone.0154809

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## compare demographic trajectories in Netherlands and Denmark  
## Not run:  
data(euroevol)
nld.dnk = subset(euroevol,Country=="Netherlands"|Country=="Denmark")
bins = binPrep(nld.dnk$SiteID,nld.dnk$C14Age,h=200)
dates = calibrate(nld.dnk$C14Age,nld.dnk$C14SD,normalised=FALSE)
res = permTest(dates,marks=as.character(nld.dnk$Country),nsim=1000,
bins=bins,runm=200,timeRange=c(10000,4000))
round(res$pValueList,4) #extract p-values
summary(res)
par(mfrow=c(2,1))
plot(res,focalm="Netherlands",main="Netherlands")
plot(res,focalm="Denmark",main="Denmark")

## End(Not run)

rcarbon documentation built on Oct. 1, 2018, 5:03 p.m.