fuzzify {fuzzyreg} | R Documentation |
Convert Real Value Numbers to Triangular Fuzzy Numbers
Description
Uses naive alternative methods to approximate triangular fuzzy numbers from real value number input data.
Usage
fuzzify(x, y = NULL, method = "mean", err = 0, dimnames = NULL, ...)
Arguments
x |
numeric vector. |
y |
vector that can be coerced to factor (optional). |
method |
character vector specifying the conversion method. See Details. |
err |
numeric vector. Error term for the error method. |
dimnames |
|
... |
additional parameters passed to other functions. |
Details
Converts crisp numbers in x
to a triangular fuzzy number (TFN). Optionally,
values in y
can be used as grouping elements and are coerced to a factor.
Method mean
calculates the central value of a TFN as the mean of x
given
y
, and the left and right spreads as standard deviations.
Method median
gives the central values as a median and left and right spreads
are calculated as distance of the first and third quartile from the median.
Method zero
inserts zeros to both spreads.
Method error
uses a user-defined numeric value or vector for the spreads.
The length of the numeric vector in argument err
must be in
(1, length(x)
, 2 * length(x)
).
Value
A data.frame with columns representing the central value, left and right spread of
x
and the values in y
coerrced to a factor. Attempt is made to inherit
names from the input data. Methods
mean
and zero
will return symmetric TFNs, whereas methods median
and
error
can return non-symmetric TFNs depending on input data and the data or the
values in the err
argument.
Examples
fuzzify(1:5)
fuzzify(1:6, c(1,1,1,2,2,2), method = "err", err = runif(6) * 1e-3)