warnProb: Calculate posterior probability of the weaning parameters

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/warn_s3.R

Description

warnProb calculate posterior probabilities under a given class "warn" object and a given parameter range.

Usage

1
2
## Default S3 method:
warnProb(object, weaning.par = "age", range.x, range.y = NA)

Arguments

object

an object of class "warn".

weaning.par

character for the intended weanig parameter. The allowed values are "age" (the default), "enrich", and "wnfood".

range.x, range.y

numeric vectors of length 2, giving the range of the intended weanig parameters. For example, range.x corresponds to the age at the start of weaning if weaning.par = "age". range.y is used only if weaning.par = "age", and corresponds to the age at the end of weaning. Fractional point lower than e-002 is rounded.

Details

warnProb calculates posterior probability of the weaning parameter that ranges between designated range. Parameter distribution is represented as the product of kernel density estimation performed in warn. Weaning ages are estimated from two-dimensional probability distribution, and nitrogen isotope ratios (d15Ns) of enrichment factor and weaning food derived collagen are from one-dimensional.

Value

warnProb returns an object of class "warnProb" which is a subclass of "warn".
The functions summary and plot are used to obtain and indicate a summary and figure of the results, respectively.
An object of class "warnProb" at least has following list components in addition to those succeeded from "warn":

probability

posterior probability of parameter that range between the designated range.

range

a vector giving the range of the intended weanig parameter.

weaning.par

a character indicating the weaning parameter used.

Author(s)

Takumi Tsutaya developed this model.

References

Tsutaya, T., and Yoneda, M. (2013). Quantitative reconstruction of weaning ages in archaeological human populations using bone collagen nitrogen isotope ratios and approximate Bayesian computation. PLoS ONE 8, e72327.

See Also

WARN, warn, warnCI, summary.warnProb, plot.warnProb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Data from the Lerna population.
nonadult <- subset(lerna, lerna$age <= 10)
adult <- subset(lerna, lerna$age > 17)
female <- subset(adult, adult$sex == "f")

## Calculate maximum density estimators using ABC.
warn.lerna <- warn(
  age = nonadult$age,
  d15N = nonadult$d15N,
  female.mean = mean(female$d15N),
  num.particle = 500,
  female.sd = sd(female$d15N),
  prior = c(0.2, 0.2, 1.6, 0.2, 2.5, 0.2, 8.1, 0.2, 0, 0.7),
  tolerances = c(1.5, 0.7))

## Calculate probabilities for a given parameter range.
warnprob.age <- warnProb(warn.lerna, "age", c(0.0, 1.1), c(0.8, 2.3))
warnprob.enrich <- warnProb(warn.lerna, "enrich", c(1.5, 3.5))
warnprob.wnfood <- warnProb(warn.lerna, "wnfood", c(7.3, 8.8))

## Indicate summary.
summary(warnprob.age)
summary(warnprob.enrich)

## Plot.
plot(warnprob.age)
plot(warnprob.wnfood)

## Plot with image.
plot(warnprob.age, is.image = TRUE)

Example output

Remains: 2 1 
Call:
warnProb.default(object = warn.lerna, weaning.par = "age", range.x = c(0, 
    1.1), range.y = c(0.8, 2.3))

Weaning parameter:
[1] "age"

Range:
from.x   to.x from.y   to.y 
   0.0    1.1    0.8    2.3 

Probability:
[1] 1

Call:
warnProb.default(object = warn.lerna, weaning.par = "enrich", 
    range.x = c(1.5, 3.5))

Weaning parameter:
[1] "enrich"

Range:
from.x   to.x 
   1.5    3.5 

Probability:
[1] 0.9962134

WARN documentation built on Oct. 30, 2019, 9:57 a.m.