Learn R Programming

snreg (version 1.2.0)

TOwen1: Compute Owen's T Function T(h, a)

Description

TOwen1 computes an Owen's \(T\)-function variant (or a related special function) for vectors h and a based on the tha function in https://people.sc.fsu.edu/~jburkardt/c_src/owen/owen.html. Non-finite inputs in h or a yield NA at the corresponding positions.

Usage

TOwen1(h, a, threads = 1)

Value

A numeric vector of length length(h) with the computed values. Elements where either h or a is non-finite are NA. The returned vector is given class "snreg" for downstream compatibility.

Arguments

h

numeric vector of \(h\) arguments.

a

numeric vector of \(a\) arguments. Must be either the same length as h or of length 1 (will be recycled by standard R rules).

threads

integer. Number of threads to request from the C implementation (if supported). Default is 1.

Details

Owen's T Function Variant via C Backend

Owen's \(T\) function is commonly defined as $$T(h, a) \;=\; \frac{1}{2\pi} \int_{0}^{a} \frac{\exp\!\left(-\tfrac{1}{2}h^2 (1+t^2)\right)}{1+t^2} \, dt,$$ for real \(h\) and \(a\).

See Also

TOwen

Examples

Run this code
  library(snreg)
  
  # Basic usage. Vectorized 'a':
  h <- c(-1, 0, 1, 2)
  a <- 0.3
  TOwen1(h, a)

  # Vectorized 'a' with non-finite entries:
  a2 <- c(0.2, NA, 1, Inf)
  TOwen1(h, a2)

Run the code above in your browser using DataLab