Learn R Programming

alR (version 2.2.0)

kappa4Int: Arc length of four-parameter kappa CDF.

Description

Calculate the arc length for a univariate four-parameter kappa cumulative distribution function over a specified interval.

Usage

kappa4Int(mu, sigma, h, k, tau, q1, q2, quantile)

kappa4Int2(mu, sigma, h, k, tau, q1, q2, quantile)

Arguments

mu

A real number specifying the location parameter.

sigma

A positive real number specifying the scale parameter.

h, k

Real numbers specifying the two shape parameters.

tau

A real number between 0 and 1, corresponding to the CDF value at the point of truncation.

q1

The point (or vector for kappa4Int2) specifying the lower limit of the arc length integral.

q2

The point (or vector for kappa4Int2) specifying the upper limit of the arc length integral.

quantile

Logical, TRUE/FALSE, whether q1 and q2 are quantiles, or actual points in the domain.

Value

kappa4Int: A list with the following components:

  • value: The resultant arc length.

  • abs.err: The absolute error between iterations. subdivisions: Number of subdivisions used in the numerical approximation.

  • neval: Number of function evaluations used by the numerical approximation.

kappa4Int2: A vector having length equal to that of the vector of lower quantile bounds, containing the arc lengths requested for a four-parameter kappa cumulative distribution function.

Details

The arc length of a univariate four-parameter kappa cumulative distribution function is approximated using the numerical integration C code implimented for R's integrate functions, i.e. using Rdqags. For this approximation, subdiv = 100 (100 subdivisions), and eps_abs = eps_rel = 1e-10, i.e. the absolute and relative errors respectively.

Examples

Run this code
# NOT RUN {
library(alR)
mu <- 4
sigma <- 0.4
h <- -4
tau <- 1 ## no truncation
k <- kappa4tc(-4, 0, 1)$par
kappa4Int(mu, sigma, h, k, tau, 0.025, 0.975, TRUE)
p1 <- qkappa4(0.025, mu, sigma, h, k)
p2 <- qkappa4(0.975, mu, sigma, h, k)
kappa4Int(mu, sigma, h, k, tau, p1, p2, FALSE)

kappa4Int2(mu, sigma, h, k, tau, c(0.025, 0.5), c(0.5, 0.975), TRUE)
p12 <- qkappa4(0.5, mu, sigma, h, k)
kappa4Int2(mu, sigma, h, k, tau, c(p1, p12), c(p12, p2), FALSE)

# }

Run the code above in your browser using DataLab