Learn R Programming

ADMUR (version 1.0.3)

CPLparsToHinges: 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).

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 2n-1 parameters (n-1 x-parameters and n y-parameters) that are mapped to n+1 PD coordinates (x,y pairs) using a modified Stick Breaking Dirichlet Process. The first and last x-coordinate are set as x_min and x_max, and the remaining internal x-coordinates are converted from their respective x-parameters using the Beta distribution CDF (where = 1 and = 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, ) using the formula 1(1 - y)^2 - 1, and the single remaining y-coordinate is set as 1(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 n pieces: Area = _i=1^n (y_i + y_i+12)(x_i+1 - x_i)

Examples

Run this code
# NOT RUN {
	# convert a single random 6-CPL parameter set
	x <- CPLparsToHinges(pars=runif(11), years=5500:7500)
	
# }

Run the code above in your browser using DataLab