CPLparsToHinges: Converts CPL parameters (0 to 1) into hinge (x,y) coordinates...

View source: R/functions.R

CPLparsToHingesR Documentation

Converts CPL parameters (0 to 1) into hinge (x,y) coordinates (date and pdf) that describe a model

Description

Converts either a vector of parameters, or a matrix of many parameter sets to CPL-model hinges (date and pdf coordinates) \loadmathjax

Usage

CPLparsToHinges(pars, years)

Arguments

pars

Either a vector of one parameter set, or a matrix of several parameter sets (one set per row).

years

A vector of years.

Details

The CPL model requires pars to be of odd length, each between 0 and 1. A n-CPL model has \mjseqn2n-1 parameters (\mjseqnn-1 x-parameters and \mjseqnn y-parameters) that are mapped to \mjseqnn+1 PD coordinates (x,y pairs) using a modified Stick Breaking Dirichlet Process. The first and last x-coordinate are set as \mjseqnx_min and \mjseqnx_max, and the remaining internal x-coordinates are converted from their respective x-parameters using the Beta distribution CDF (where \mjseqn\alpha = 1 and \mjseqn\beta = the number of pieces still to be broken). The y-parameters (between 0 and 1) are converted to y-coordinates in two steps. Firstly, they are mapped from the parameter range (0,1) to the coordinate range (0, \mjseqn\infty) using the formula \mjseqn\frac1(1 - y)^2 - 1, and the single remaining y-coordinate is set as \mjseqn\frac1(1 - 0.5)^2 - 1. Secondly, they are normalised by the total area under the curve, calculated as the sum of the areas under all \mjseqnn pieces: \mjsdeqnArea = \sum_i=1^n (\fracy_i + y_i+12)(x_i+1 - x_i)

Examples

	# convert a single random 6-CPL parameter set
	x <- CPLparsToHinges(pars=runif(11), years=5500:7500)
	

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