Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

loglik

Calculates the log likelihood of a population model, given a calibrated date PD matrix


Description

Calculates the log likelihood of a population model, given a calibrated date PD matrix

Usage

loglik(PD, model)

Arguments

PD

A data frame of Probability Distributions (PDs). Each column representing the PD of a calibrated observation or phase. Row names correspond to the calendar years BP. This data frame can be generated by phaseCalibrator

model

A data frame containing the columns 'pdf' representing a hypothesised population Probability Density Function; and 'year' corresponding to the calendar years BP.

Details

Row names of both PD and model arguments must exactly match, since the probability of each phase given the model is calculated numerically.

Value

Returns a single numeric log likelihood.

Examples

# calibrate a dataset comprising just two phases
	data <- data.frame(age=c(5800, 5100),sd=c(40, 35),phase=c('p1', 'p2'), datingType='14C')
	CalArray <- makeCalArray(shcal20, calrange = range(toy$year))
	PD <- phaseCalibrator(data, CalArray)	

	# calculate toy model log likelihood
	loglik(PD, toy)

ADMUR

Ancient Demographic Modelling Using Radiocarbon

v1.0.3
GPL-3
Authors
Adrian Timpson [aut, cre] (<https://orcid.org/0000-0003-0292-8729>)
Initial release
2021-03-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.