Learn R Programming

desiR (version 1.2.2)

d.high: High values are desirable

Description

Maps a numeric variable to a 0-1 scale such that high values are desirable.

Usage

d.high(x, cut1, cut2, des.min = 0, des.max = 1, scale = 1)

Arguments

x

Vector of numeric or integer values.

cut1, cut2

Values of the original data that define where the desirability function changes.

des.min, des.max

Minimum and maximum desirability values. Defaults to zero and one, respectively.

scale

Controls how steeply the function increases or decreases.

Value

Numeric vector of desirability values.

Details

Values less than cut1 will have a low desirability. Values greater than cut2 will have a high desirability. Values between cut1 and cut2 will have intermediate values.

See Also

d.low, d.4pl

Examples

Run this code
# NOT RUN {
set.seed(1)
x <- rnorm(1000, mean=100, sd =5) # generate data
d <- d.high(x, cut1=90, cut2=110, scale=1)

# plot data
hist(x, breaks=30)
# add line
des.line(x, "d.high", des.args=c(cut1=90, cut2=110, scale=1))

hist(x, breaks=30)
des.line(x, "d.high", des.args=c(cut1=90, cut2=110, des.min=0.1,
des.max=0.95, scale=1.5))
# }

Run the code above in your browser using DataLab