loglik: Calculates the log likelihood of a population model, given a...

View source: R/functions.R

loglikR Documentation

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.

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)

AdrianTimpson/ADMUR documentation built on July 2, 2024, 8:39 p.m.