NormalizeBoundedVariable: Take a variable bounded above/below/both and return an...

Description Usage Arguments Value Author(s) Examples

View source: R/NormalizeBoundedVariable.R

Description

This transforms bounded variables so that they are not bounded. First variables are coerced away from the boundaries. by a distance of tol. The natural log is used for variables bounded either above or below but not both. The inverse of the standard normal cumulative distribution function (the quantile function) is used for variables bounded above and below.

Usage

1
2
NormalizeBoundedVariable(x, constraints, tol = stats::pnorm(-5),
  trim = TRUE)

Arguments

x

A vector, matrix, array, or dataframe with value to be coerced into a range or set.

constraints

A list of constraints. See the examples below for formatting details.

tol

Variables will be forced to be at least this far away from the boundaries.

trim

If TRUE values in x < lower and values in x > upper will be set to lower and upper, respectively, before normalizing.

Value

An object of the same class as x with the values transformed so that they spread out over any part of the real line.

A variable x that is bounded below by lower is transformed to log(x - lower).

A variable x that is bounded above by upper is transformed to log(upper - x).

A variable x that is bounded below by lower and above by upper is transformed to qnorm((x-lower)/(upper - lower)).

Author(s)

Stephen R. Haptonstahl srh@haptonstahl.org

Examples

1
2
3
  constraints=list(lower=5)           # lower bound when constrining to an interval
  constraints=list(upper=10)          # upper bound when constraining to an interval
  constraints=list(lower=5, upper=10) # both lower and upper bounds

Example output



FastImputation documentation built on May 1, 2019, 10:53 p.m.