Generator of h and hp (derivative of \(h\)) functions.
get_h_hp(mode, para = NULL, para2 = NULL)A string, see details.
May be optional. A number, the first parameter. Default to NULL.
May be optional. A number, the second parameter. If mode is one of the adaptive mode below, this specifies the percentile (see details). Default to NULL.
A function that returns a list containing hx=h(x) (element-wise) and hpx=hp(x) (element-wise derivative of \(h\)) when applied to a vector (for mode names not ending with "_ada" only) or a matrix x, with both of the results having the same shape as x.
The mode parameter can be chosen from the options listed below along with the corresponding definitions of h under appropriate choices of para and para2 parameters. Unless otherwise noted, para and para2, must both be strictly positive if provided, and are set to 1 if not provided. Functions h and hp should only be applied to non-negative values x and this is not enforced or checked by the functions.
Internally calls get_h_hp_vector.
asinhAn asinh function \(\boldsymbol{h}(\boldsymbol{x})=\mathrm{asinh}(\mathrm{para}\cdot\boldsymbol{x})=\log\left(\mathrm{para}\cdot\boldsymbol{x}+\sqrt{(\mathrm{para}\cdot\boldsymbol{x})^2+1}\right)\). Unbounded and takes one parameter. Equivalent to min_asinh(x, para, Inf).
coshA shifted cosh function \(\boldsymbol{h}(\boldsymbol{x})=\cosh(\mathrm{para}\cdot\boldsymbol{x})-1\). Unbounded and takes one parameter. Equivalent to min_cosh(x, para, Inf).
expA shifted exponential function \(\boldsymbol{h}(\boldsymbol{x})=\exp(\mathrm{para}\cdot\boldsymbol{x})-1\). Unbounded and takes one parameter. Equivalent to min_exp(x, para, Inf).
identityThe identity function \(\boldsymbol{h}(\boldsymbol{x})=\boldsymbol{x}\). Unbounded and does not take any parameter. Equivalent to pow(x, 1) or min_pow(x, 1, Inf).
log_powA power function on a log scale \(\boldsymbol{h}(\boldsymbol{x})=\log(1+\boldsymbol{x})^{\mathrm{para}}\). Unbounded and takes one parameter. Equivalent to min_log_pow(x, para, Inf).
mcpTreating \(\lambda\)=para, \(\gamma\)=para2, the step-wise MCP function applied element-wise: \(\lambda x-x^2/(2\gamma)\) if \(x\leq\lambda\gamma\), or \(\gamma\lambda^2/2\) otherwise. Bounded and takes two parameters.
min_asinhA truncated asinh function applied element-wise: \(\min(\mathrm{asinh}(\mathrm{para}\cdot\boldsymbol{x}),\mathrm{para}_2)\). Bounded and takes two parameters.
min_asinh_adaAdaptive version of min_asinh.
min_coshA truncated shifted cosh function applied element-wise: \(\min(\cosh(\mathrm{para}\cdot\boldsymbol{x})-1,\mathrm{para}_2)\). Bounded and takes two parameters.
min_cosh_adaAdaptive version of min_cosh.
min_expA truncated shifted exponential function applied element-wise: \(\boldsymbol{h}(\boldsymbol{x})=\min(\exp(\mathrm{para}\cdot\boldsymbol{x})-1,\mathrm{para}_2)\). Bounded and takes two parameters.
min_exp_adaAdaptive version of min_exp.
min_log_powA truncated power on a log scale applied element-wise: \(\boldsymbol{h}(\boldsymbol{x})=\min(\log(1+\boldsymbol{x}),\mathrm{para}_2)^{\mathrm{para}}\). Bounded and takes two parameters.
min_log_pow_adaAdaptive version of min_log_pow.
min_powA truncated power function applied element-wise: \(\boldsymbol{h}(\boldsymbol{x})=\min(\boldsymbol{x},\mathrm{para}_2)^{\mathrm{para}}\). Bounded and takes two parameters.
min_pow_adaAdaptive version of min_pow.
min_sinhA truncated sinh function applied element-wise: \(\min(\sinh(\mathrm{para}\cdot\boldsymbol{x}),\mathrm{para}_2)\). Bounded and takes two parameters.
min_sinh_adaAdaptive version of min_sinh.
min_softplusA truncated shifted softplus function applied element-wise: \(\min(\log(1+\exp(\mathrm{para}\cdot\boldsymbol{x}))-\log(2),\mathrm{para}_2)\). Bounded and takes two parameters.
min_softplus_adaAdaptive version of min_softplus.
powA power function \(\boldsymbol{h}(\boldsymbol{x})=\boldsymbol{x}^{\mathrm{para}}\). Unbounded and takes two parameter. Equivalent to min_pow(x, para, Inf).
scadTreating \(\lambda\)=para, \(\gamma\)=para2, the step-wise SCAD function applied element-wise: \(\lambda x\) if \(x\leq\lambda\), or \((2\gamma\lambda x-x^2-\lambda^2)/(2(\gamma-1))\) if \(\lambda<x<\gamma\lambda\), or \(\lambda^2(\gamma+1)/2\) otherwise. Bounded and takes two parameters, where para2 must be larger than 1, and will be set to 2 by default if not provided.
sinhA sinh function \(\boldsymbol{h}(\boldsymbol{x})=\sinh(\mathrm{para}\cdot\boldsymbol{x})\). Unbounded and takes one parameter. Equivalent to min_sinh(x, para, Inf).
softplusA shifted softplus function \(\boldsymbol{h}(\boldsymbol{x})=\log(1+\exp(\mathrm{para}\cdot\boldsymbol{x}))-\log(2)\). Unbounded and takes one parameter. Equivalent to min_softplus(x, para, Inf).
tanhA tanh function \(\boldsymbol{h}(\boldsymbol{x})=\tanh(\mathrm{para}\cdot\boldsymbol{x})\). Bounded and takes one parameter.
truncated_sinA truncated sin function applied element-wise: \(\sin(\mathrm{para}\cdot x)\) if \(\mathrm{para}\cdot x\leq\pi/2\), or 1 otherwise. Bounded and takes one parameter.
truncated_tanA truncated tan function applied element-wise: \(\tan(\mathrm{para}\cdot x)\) if \(\mathrm{para}\cdot x\leq\pi/4\), or 1 otherwise. Bounded and takes one parameter.
For the adaptive modes (names ending with "_ada"), h and hp are first applied to x without truncation. Then inside each column, values that are larger than the para2-th quantile will be truncated. The quantile is calculated using finite values only, and if no finite values exist the quantile is set to 1.
For example, if mode == "min_pow_ada", para == 2, para2 == 0.4, the j-th column of the returned hx will be pmin(x[,j]^2, stats::quantile(x[,j]^2, 0.4)), and the j-th column of hpx will be 2*x[,j]*(x[,j] <= stats::quantile(x[,j]^2, 0.4)).
# NOT RUN {
get_h_hp("mcp", 2, 4)(0:10)
get_h_hp("min_log_pow", 1, log(1+3))(matrix(0:11, nrow=3))
get_h_hp("min_pow", 1.5, 3)(seq(0, 5, by=0.5))
get_h_hp("min_softplus")(matrix(seq(0, 2, by=0.1), nrow=7))
get_h_hp("min_log_pow_ada", 1, 0.4)(matrix(0:49, nrow=10))
get_h_hp("min_pow_ada", 2, 0.3)(matrix(0:49, nrow=10))
get_h_hp("min_softplus_ada", 2, 0.6)(matrix(seq(0, 0.49, by=0.01), nrow=10))
# }
Run the code above in your browser using DataLab