get_trun: The truncation point for 'h' for 'h' that is truncated...

View source: R/genscore.R

get_trunR Documentation

The truncation point for h for h that is truncated (bounded but not naturally bounded).

Description

The truncation point for h for h that is truncated (bounded but not naturally bounded).

Usage

get_trun(mode, param1, param2)

Arguments

mode

A string, the class of the h function. Must be one of "mcp", "scad", "min_asinh", "min_cosh", "min_exp", "min_log_pow", "min_pow", "min_sinh", "min_softplus", "truncated_sin", and "truncated_tan".

param1

A number, the first parameter to the h function.

param2

A number, the second parameter (may be optional depending on mode) to the h function.

Value

Returns the truncation point (the point x0 such that h becomes constant and hp becomes 0 for x >= x0) for some selected modes.

Examples

param1 <- 1.3; param2 <- 2.3
for (mode in c("mcp", "scad", "min_asinh", "min_cosh", "min_exp", "min_log_pow",
    "min_pow", "min_sinh", "min_softplus", "truncated_tan")) {
  # Valgrind complains about "truncated_sin" for unknown reason; omitted
  print(mode)
  trun <- get_trun(mode, param1, param2)
  x <- trun + -3:3 / 1e5
  hx_hpx <- get_h_hp(mode, param1, param2)(x)
  print(round(x, 6))
  print(paste("hx:", paste(hx_hpx$hx, collapse=" ")))
  print(paste("hpx:", paste(hx_hpx$hpx, collapse=" ")))
}

genscore documentation built on May 29, 2024, 9 a.m.