solveIsotone: Solve for best single-direction (non-decreasing or...

Description Usage Arguments Details Value Examples

View source: R/isotone.R

Description

Return a vector of length y that is a function of x (differs at must where x differs) obeying the either the same order contraints or the opposite order constraints as x. This vector is picked as close to y (by square-distance) as possible.

Usage

1
solveIsotone(varName, x, y, w = NULL)

Arguments

varName

character, name of variable

x

numeric, factor, or character input (not empty, no NAs).

y

numeric (same length as x no NAs), output to match

w

numeric positive, same length as x (weights, can be NULL)

Details

Please see https://github.com/WinVector/vtreat/blob/main/extras/MonotoneCoder.md.

Value

isotonicly adjusted y (non-decreasing)

Examples

1
2
3
if(requireNamespace("isotone", quietly = TRUE)) {
   solveIsotone('v', 1:3, c(1,2,1))
}

vtreat documentation built on June 11, 2021, 5:13 p.m.