Learn R Programming

desiR (version 1.2.2)

des.line: Plots a desirability function on an existing graph

Description

Plots any of the desirability functions on top of a graph, usually a histogram or density plot.

Usage

des.line(x, des.func, des.args, ...)

Arguments

x

Vector of numeric or integer values.

des.func

Name of the desirability function to plot (in quotes).

des.args

A vector of named arguments for the chosen desirability function.

...

Arguments for the plotting function (e.g. xlim, lwd, lty).

Value

Plotted values of the desirability function.

Details

This function can be used to visualise how the desirabilities are mapped from the raw data to a 0-1 scale, which can help select suitable cut points. The scale of the y-axis has a minimum of 0 and a maximum of 1.

WARNING: If you set xlim values for the histogram or density plot, then you must pass the same xlim values to des.line; otherwise the data and desirability function (plotted line) will be misaligned. If xlim is not set, then the same default values will be used for the data and the function.

See Also

d.low, d.high, d.central, d.ends, d.4pl

Examples

Run this code
# NOT RUN {
set.seed(1)
x1 <- rnorm(100, 10, 2)
hist(x1, breaks=10)
des.line(x1, "d.high", des.args=c(cut1=10, cut2=11))
des.line(x1, "d.high", des.args=c(cut1=10, cut2=11,
des.min=0.1, scale=0.5))
# }

Run the code above in your browser using DataLab