session 2a

This page contains the R code that was ran in the second session of the GSA Short Course on age-modeling. The first part covered the theory (part 2a), and then the practicalities of running rbacon (part 2b) were covered. The latter part will be repeated next week.

The presentation slides of this session can be downloaded from these links: .odp or .pptx.

The .Rmd script is here: session 2a .

The streamed session is available here:
video on youtube
chats
transcript

The first slides which we could reproduce here were done using the R package clam. Assuming you have it installed already (see here), then you simply need to load the code:

require(clam)
## Loading required package: clam
## 
## Attaching package: 'clam'
## The following object is masked from 'package:rbacon':
## 
##     add.dates

The basic, default model is linear interpolation through the dated levels of the standard core that comes with clam:

clam()
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
##  Interpolating, sampling.....
## 
##  Removing1models with age reversals,999models left...
## 
## Example's 95% confidence ranges span from 20 to 529 yr (average 228 yr)
##   Fit (-log, lower is better):5.94

We can also assume that the sixth date in the sequence is outlying:

clam(outliers=6)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
##  Interpolating, sampling.....
## 
##  Removing1models with age reversals,999models left...
## 
## Example's 95% confidence ranges span from 19 to 528 yr (average 246 yr)
##   Fit (-log, lower is better):6.73

Or assume that a hiatus happened at 470 cm core depth, causing a gap in time:

clam(hiatus=470)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
## 
##  section 1,
##  Interpolating, sampling.....
## 
##  section 2,
##  Interpolating, sampling.....
## 
##  Removing1models with age reversals,999models left...
## 
## Example's 95% confidence ranges span from 20 to 573 yr (average 233 yr)
##   Fit (-log, lower is better):6.78

We can also assume this hiatus and instead of linear interpolation, draw a linear regression between the dates in the sections below and above the hiatus (linear regression can be activated by specifying type=2):

clam(type=2, hiatus=470)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
## 
##  section 1,
##  Using linear regression, sampling
## .....
## 
##  section 2,
##  Using linear regression, sampling
## .....
## 
## Example's 95% confidence ranges span from 141 to 456 yr (average 269 yr)
##   Fit (-log, lower is better):21.44

Or a higher-order polynomial regression, to the second degree (since model type and its degree are the second and third clam options, you can also leave out the names of the options and simply add their values in their places):

clam(,2 , 2, hiatus=470)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
## 
##  section 1,
##  Using polynomial regression (degree 2), sampling
## .....
## 
##  section 2,
##  Using polynomial regression (degree 2), sampling
## .....
## 
## Example's 95% confidence ranges span from 54 to 598 yr (average 230 yr)
##   Fit (-log, lower is better):9.13

or a polynomial regression to the third degree:

clam(, 2, 3, hiatus=470)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
## 
##  section 1,
##  Using polynomial regression (degree 3), sampling
## .....
## 
##  Removing24models with age reversals,976models left...
## 
##  section 2,
##  Using polynomial regression (degree 3), sampling
## .....
## 
##  Removing9models with age reversals,991models left...
## 
## Example's 95% confidence ranges span from 42 to 2098 yr (average 487 yr)
##   Fit (-log, lower is better):8.05

You can also draw a smooth spline through the dates (type=4):

clam(,4)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
##  Using smoothing spline (smoothing 0.3), sampling
## .....
## 
##  Removing64models with age reversals,936models left...
## 
## Example's 95% confidence ranges span from 28 to 2179 yr (average 675 yr)
##   Fit (-log, lower is better):386.15

and again remove the sixth date as outlier:

clam(,4, outliers=6)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
##  Using smoothing spline (smoothing 0.3), sampling
## .....
## 
##  Removing14models with age reversals,986models left...
## 
## Example's 95% confidence ranges span from 26 to 668 yr (average 349 yr)
##   Fit (-log, lower is better):52.84

or instead assume a hiatus:

clam(,4, hiatus=470)
## The run's files will be put in this folder: /home/maarten/Dropbox/github_site/GSA_agemodeling/clam_runs/Example
## 
##  Warning, some dates lie partly outside the calibration curve!
##  Calibrating dates...
## 
##  section 1,
##  Using smoothing spline (smoothing 0.3), sampling
## .....
## 
##  section 2,
##  Using smoothing spline (smoothing 0.3), sampling
## .....
## 
## Example's 95% confidence ranges span from 31 to 478 yr (average 236 yr)
##   Fit (-log, lower is better):8.53


prev: session 1
next: session 2b