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

Description Usage Arguments Value Examples

View source: R/genscore.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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 April 28, 2020, 1:06 a.m.