Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
^cran-comments.md$
^\.travis\.yml$
^CRAN-RELEASE$
^\.github$
51 changes: 51 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
25 changes: 25 additions & 0 deletions .github/workflows/render-vignette-yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on:
push:
branches:
- main
name: vignettes
jobs:
vignette:
name: Render-Vignette
runs-on: ubuntu-latest
container:
image: rocker/tidyverse
steps:
- uses: actions/checkout@v4
- name: Install R dependencies
run: Rscript -e 'install.packages(c("DEoptimR","mathjaxr"))'
- name: Render Vignette
run: Rscript -e 'rmarkdown::render("vignette/guide.Rmd", output_dir = "vignette_output")'
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: vignette_output
CLEAN: true

1 change: 1 addition & 0 deletions R/functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#--------------------------------------------------------------------------------------------
# global variables
# if(getRversion() >= "2.15.1") utils::globalVariables(c())
utils::globalVariables("intcal20")
#--------------------------------------------------------------------------------------------
getTruncatedModelChoices <- function(){
# Required in several functions, so avoids duplication if others are added to the package
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<a href="https://www.shh.mpg.de"><img src="tools/logos/logo_MPI.png" alt="Max Planck Institute for the Science of Human History" height="70"/></a>
<a href="https://www.shh.mpg.de/1143811/pan-ev"><img src="tools/logos/logo_PanEv.png" alt="Pan African Evolution ResearchGroup" height="70"/></a>

[![Build Status](https://app.travis-ci.com/AdrianTimpson/ADMUR.svg?branch=master)](https://app.travis-ci.com/AdrianTimpson/ADMUR)

# ADMUR
## Ancient Demographic Modelling Using Radiocarbon

[![R-CMD-check](https://github.com/simoncarrignon/ADMUR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/simoncarrignon/ADMUR/actions/workflows/R-CMD-check.yaml)

Statistical tools to directly model underlying population dynamics using date datasets (radiocarbon and other).

### Population modelling
Expand Down Expand Up @@ -74,4 +74,4 @@ Also thanks to the following who have reported bugs, requested additional functi
- Ricardo Fernandes
- Mark G. Thomas
- Robert Staniuk
---
---
2 changes: 1 addition & 1 deletion man/SPDsimulationTest.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
The default N = 20000 can be increased if greater precision is required, however this can be very time costly.
}
\examples{
\donttest{
\dontrun{
# trivial example showing a single date can never be rejected under a uniform model:
data <- data.frame(age=6500, sd=50, phase=1, datingType='14C')
x <- SPDsimulationTest(data,
Expand Down
2 changes: 1 addition & 1 deletion man/getPhaseModelChoices.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\description{
Lists currently available models for the PDF of an archaeological phase, the number of parameters, and a brief description
\loadmathjax }
\usage{getTruncatedModelChoices()}
\usage{getPhaseModelChoices()}

\details{

Expand Down
3 changes: 2 additions & 1 deletion man/intcal20.Rd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\name{intcal20}
\docType{data}
\name{intcal20}
\alias{intcal20}
\title{Northern hemisphere 2020 calibration curve}
\description{
Expand All @@ -17,3 +17,4 @@
}
\references{Reimer P, Austin WEN, Bard E, Bayliss A, Blackwell PG, Bronk Ramsey C, Butzin M, Cheng H, Edwards RL, Friedrich M, Grootes PM, Guilderson TP, Hajdas I, Heaton TJ, Hogg AG, Hughen KA, Kromer B, Manning SW, Muscheler R, Palmer JG, Pearson C, van der Plicht J, Reimer RW, Richards DA, Scott EM, Southon JR, Turney CSM, Wacker L, Adolphi F, Büntgen U, Capano M, Fahrni S, Fogtmann-Schulz A, Friedrich R, Köhler P, Kudsk S, Miyake F, Olsen J, Reinig F, Sakamoto M, Sookdeo A, Talamo S. 2020. The IntCal20 Northern Hemisphere radiocarbon age calibration curve (0-55 cal kBP). Radiocarbon 62. doi: 10.1017/RDC.2020.41.}

\keyword{datasets}
2 changes: 1 addition & 1 deletion man/mcmc.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ cal <- simulateCalendarDates(toy, N)
age <- uncalibrateCalendarDates(cal, shcal20)
data <- data.frame(age = age, sd = 50, phase = 1:N, datingType = '14C')

\donttest{
\dontrun{
# Calibrate each phase, taking care to restrict to the modelled date range
CalArray <- makeCalArray(shcal20, calrange = range(toy$year), inc = 5)
PD <- phaseCalibrator(data, CalArray, remove.external = TRUE)
Expand Down
15 changes: 12 additions & 3 deletions man/phaseModel.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,18 @@
# specify the prior probabilities of the parameter values of a gaussian model in a matrix
mu.range <- c(5500,7000)
sigma.range <- c(5,700)
prior.matrix <- matrix(1,150,150); prior.matrix <- prior.matrix/sum(prior.matrix)
row.names(prior.matrix) <- seq(min(mu.range),max(mu.range),length.out=nrow(prior.matrix))
colnames(prior.matrix) <- seq(min(sigma.range),max(sigma.range),length.out=ncol(prior.matrix))
prior.matrix <- matrix(1,150,150)
prior.matrix <- prior.matrix/sum(prior.matrix)
row.names(prior.matrix) <- seq(
from = min(mu.range),
to = max(mu.range),
length.out = nrow(prior.matrix)
)
colnames(prior.matrix) <- seq(
from = min(sigma.range),
to = max(sigma.range),
length.out=ncol(prior.matrix)
)

# generate the posterior parameter probabilities
pm <- phaseModel(data, calcurve, prior.matrix, model='norm', plot=TRUE)
Expand Down
1 change: 1 addition & 0 deletions man/plotCalArray.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
\examples{
\donttest{
# generate a CalArray of the intcal20 curve covering 5500 calBP to 6000 calBP
data(intcal20)
x <- makeCalArray( calcurve = intcal20, calrange = c(5500,6000), inc = 1 )
plotCalArray(x)
}
Expand Down
2 changes: 1 addition & 1 deletion man/plotSimulationSummary.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
Default NULL for legend.x and legend.y will automatically add a legend, which may not be ideally placed to avoid overlapping other components of the plot. To remove the legend, simply place well outside the boundary.
}
\examples{
\donttest{
\dontrun{
summary <- SPDsimulationTest(data=SAAD,
calcurve=shcal20,
calrange=c(2500,14000),
Expand Down
12 changes: 9 additions & 3 deletions vignettes/guide.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ output:
logo: logo.jpg
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Guide to using ADMUR}
%\VignetteIndexEntry{ADMUR: Ancient Demographic Modelling Using Radiocarbon }
%\usepackage[utf8]{inputenc}
---

<style>
p.caption {font-size: 0.7em;}
</style>

```{r setup, include=FALSE}
options(rmarkdown.html_vignette.check_title = FALSE)
```

**********

# 1. Overview
Expand Down Expand Up @@ -93,7 +98,7 @@ data6[1:10,]

**********

# 2. radiocarbon date calibration and SPDs
# 2. Radiocarbon date calibration and SPDs

Generating a single calibrated date distribution, or a Summed Probability Distribution (SPD) of several calibrated dates, requires either a two-step process to give the user full control of the date range and temporal resolution, or a simpler one step process using a wrapper function that automatically estimates a sensible date range and resolution from the dataset.

Expand Down Expand Up @@ -124,6 +129,7 @@ Generating the SPD without the wrapper gives you more control, and requires a tw
This is useful for improving computational times if generating many SPDs, for example in a simulation framework, since the CalArray needs generating only once.

```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='jpeg', quality=100, warning=FALSE}
data(intcal20)
data <- data.frame( age = c(9144), sd=c(151) )
CalArray <- makeCalArray( calcurve=intcal20, calrange=c(8000,13000) )
cal <- summedCalibrator(data, CalArray)
Expand Down Expand Up @@ -563,7 +569,7 @@ plotPD(spd)
lines(mod.combo, col=cols[1], lwd=5)
legend(x=4000, y=max(spd)*1.2, lwd=5, col=cols[1], bty='n', legend=c('combo.sine.logistic'))
```
![Example of a combination model](combination_model.png){width=680px}
![Example of a combination model](combo_models.png){width=680px}

**********

Expand Down