Title: | Fuzzy Linear Regression |
---|---|
Description: | Estimators for fuzzy linear regression. The functions estimate parameters of fuzzy linear regression models with crisp or fuzzy independent variables (triangular fuzzy numbers are supported). Implements multiple methods for parameter estimation and algebraic operations with triangular fuzzy numbers. Includes functions for summarising, printing and plotting the model fit. Calculates predictions from the model and total error of fit. Individual methods are described in Diamond (1988) <doi:10.1016/0020-0255(88)90047-3>, Hung & Yang (2006) <doi:10.1016/j.fss.2006.08.004>, Lee & Tanaka (1999) <doi:10.15807/jorsj.42.98>, Nasrabadi, Nasrabadi & Nasrabady (2005) <doi:10.1016/j.amc.2004.02.008>, Skrabanek, Marek & Pozdilkova (2021) <doi:10.3390/math9060685>, Tanaka, Hayashi & Watada (1989) <doi:10.1016/0377-2217(89)90431-1>, Zeng, Feng & Li (2017) <doi:10.1016/j.asoc.2016.09.029>. |
Authors: | Pavel Skrabanek [aut, cph], Natalia Martinkova [aut, cre, cph] |
Maintainer: | Natalia Martinkova <[email protected]> |
License: | GPL-3 |
Version: | 0.6.2 |
Built: | 2025-02-17 03:29:13 UTC |
Source: | https://github.com/cran/fuzzyreg |
Body surface temperature of multiple species of hibernating bats and mean annual surface temperature at the hibernation site.
data(bats)
data(bats)
A data frame with 528 rows and two variables:
MAST
numeric Mean annual surface temperature at the site in degrees Celsius
temperature
numeric Body surface temperature of hibernating bats in degrees Celsius
Martinkova, N., Pikula, J., Zukal, J., Kovacova, V., Bandouchova, H., Bartonicka, T., Botvinkin, A.D., Brichta, J., Dundarova, H., Kokurewicz, T., Irwin, N.R., Linhart, P., Orlov, O.L., Piacek, V., Skrabanek, P., Tiunov, M.P. and Zahradnikova, A., Jr. (2018) Hibernation temperature-dependent Pseudogymnoascus destructans infection intensity in Palearctic bats. Virulence 9: 1734-1750.
Hijmans, R.J., Cameron, S.E., Parra, J.L., Jones, P.G. and Jarvis, A. (2005) Very high resolution interpolated climate surfaces for global land areas. International Journal of Climatology 25: 1965-1978.
data(bats) # remove outlier dat <- bats[!(bats$MAST < 0 & bats$temperature > 7), ] # fuzzy linear regression model as published fit <- fuzzylm(temperature ~ MAST, data = dat, method = "plrls", h = 0.01, k1 = 5) plot(fit, res = 30, col = "orange")
data(bats) # remove outlier dat <- bats[!(bats$MAST < 0 & bats$temperature > 7), ] # fuzzy linear regression model as published fit <- fuzzylm(temperature ~ MAST, data = dat, method = "plrls", h = 0.01, k1 = 5) plot(fit, res = 30, col = "orange")
The function calculates fuzzy regression coeficients using the Boskovitch fuzzy
regression line method (BFRL) developed by Tanaka et al. (1989). Specifically, the
min
problem is implemented in this function.
bfrl(x, y)
bfrl(x, y)
x |
matrix with two colums, representing one independent variable observations. The first column is related to the intercept, so it consists of ones. Missing values not allowed. |
y |
three column matrix of dependent variable values and the respective spread. Method assumes non-symmetric triangular fuzzy input. Missing values not allowed. |
The function input expects the response in form of a non-symmetric fuzzy number and the predictors as crisp numbers. The prediction returns non-symmetric triangular fuzzy numbers. The intercept is a non-symmetric triangular fuzzy number and the slope is a crisp number that is returned as a triangular fuzzy number with spreads equal to zero.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "bfrl"
.
Skrabanek, P., Marek, J. and Pozdilkova, A. (2021) Boscovich Fuzzy Regression Line. Mathematics 9: 685.
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$tan, "bfrl", , , "yl", "yr")
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$tan, "bfrl", , , "yl", "yr")
Extracts coefficients of the fuzzy regression model in object fuzzylm
.
## S3 method for class 'fuzzylm' coef(object, complete = TRUE, ...)
## S3 method for class 'fuzzylm' coef(object, complete = TRUE, ...)
object |
a |
complete |
not used for a |
... |
other arguments. |
matrix with coefficients for the central tendency of the model, upper and lower boundary.
The function returns real value numbers that define model predictions at
and
,
not triangular fuzzy numbers. To extract triangular fuzzy number coefficients of the
model, use
object$coef
.
data(fuzzydat) f <- fuzzylm(y ~ x, data = fuzzydat$lee) coef(f)
data(fuzzydat) f <- fuzzylm(y ~ x, data = fuzzydat$lee) coef(f)
Calculates the degree of membership of a real number to a triangular fuzzy number. The fuzzy number is defined by its central value and the left and right spreads.
dom(x, TFN)
dom(x, TFN)
x |
a numeric vector. |
TFN |
a numeric vector of length 3. |
Returns a numeric in interval [0,1]
.
x <- seq(from = 0, to = 2, length.out = 10) A <- c(1, 1, 1) dom(x, A)
x <- seq(from = 0, to = 2, length.out = 10) A <- c(1, 1, 1) dom(x, A)
The function calculates fuzzy regression coeficients using the fuzzy least absolute residual (FLAR) method proposed by Zeng et al. (2017) for non-symmetric triangular fuzzy numbers.
flar(x, y)
flar(x, y)
x |
matrix with the second to last columns representing independent variable observations. The first column is related to the intercept, so it consists of ones. Missing values not allowed. |
y |
matrix of dependent variable observations. The first column contains the central tendency, the second column the left spread and the third column the right spread of non-symmetric triangular fuzzy numbers. Missing values not allowed. |
The FLAR method expects real value input for the explanatory variables, and non-symmetric triangular fuzzy numbers for the response variable. The prediction returns non-symmetric triangular fuzzy numbers.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "flar"
.
Zeng, W., Feng, Q. and Li, J. (2017) Fuzzy least absolute linear regression. Applied Soft Computing 52: 1009-1019.
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$dia, "flar", , , "yl", "yl")
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$dia, "flar", , , "yl", "yl")
The function calculates fuzzy regression coeficients using the fuzzy least squares (FLS) method proposed by Diamond (1988) for non-symmetric triangular fuzzy numbers.
fls(x, y)
fls(x, y)
x |
two column matrix with the second column representing independent variable observations. The first column is related to the intercept, so it consists of ones. Missing values not allowed. |
y |
matrix of dependent variable observations. The first column contains the central tendency, the second column the left spread and the third column the right spread of non-symmetric triangular fuzzy numbers. Missing values not allowed. |
The FLS method for the fuzzy linear regression fits a simple model.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "fls"
.
Diamond, P. (1988) Fuzzy least squares. Information Sciences 46(3): 141-157.
data(fuzzydat) x <- fuzzydat$dia[, 1, drop = FALSE] x <- cbind(rep(1, nrow(x)), x) y <- fuzzydat$dia[, c(2,3,3)] fls(x = x, y = y)
data(fuzzydat) x <- fuzzydat$dia[, 1, drop = FALSE] x <- cbind(rep(1, nrow(x)), x) y <- fuzzydat$dia[, c(2,3,3)] fls(x = x, y = y)
Uses naive alternative methods to approximate triangular fuzzy numbers from real value number input data.
fuzzify(x, y = NULL, method = "mean", err = 0, dimnames = NULL, ...)
fuzzify(x, y = NULL, method = "mean", err = 0, dimnames = NULL, ...)
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. |
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)
).
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.
fuzzify(1:5) fuzzify(1:6, c(1,1,1,2,2,2), method = "err", err = runif(6) * 1e-3)
fuzzify(1:5) fuzzify(1:6, c(1,1,1,2,2,2), method = "err", err = runif(6) * 1e-3)
Example data reported by the authors of the respective fuzzy linear regression methods for testing model fit performance.
data(fuzzydat)
data(fuzzydat)
A list of data.frames.
Diamond, P. (1988) Fuzzy least squares. Information Sciences 46(3): 141-157.
Hung, W.-L. and Yang, M.-S. (2006) An omission approach for detecting outliers in fuzzy regression models. Fuzzy Sets and Systems 157: 3109-3122.
Lee, H. and Tanaka, H. (1999) Fuzzy approximations with non-symmetric fuzzy parameters in fuzzy regression analysis. Journal of the Operations Research Society Japan 42: 98-112.
Nasrabadi, M. M., Nasrabadi, E. and Nasrabady, A. R. (2005) Fuzzy linear regression analysis: a multi-objective programming approach. Applied Mathematics and Computation 163: 245-251.
Tanaka H., Hayashi I. and Watada J. (1989) Possibilistic linear regression analysis for fuzzy data. European Journal of Operational Research 40: 389-396.
data(fuzzydat) fuzzylm(y ~ x, data = fuzzydat$lee) fuzzylm(y ~ x, data = fuzzydat$dia, method = "fls", fuzzy.left.y = "yl", fuzzy.right.y = "yl")
data(fuzzydat) fuzzylm(y ~ x, data = fuzzydat$lee) fuzzylm(y ~ x, data = fuzzydat$dia, method = "fls", fuzzy.left.y = "yl", fuzzy.right.y = "yl")
A wrapper function that calculates fuzzy regression coeficients using a chosen method.
fuzzylm( formula, data, method = "plrls", fuzzy.left.x = NULL, fuzzy.right.x = NULL, fuzzy.left.y = NULL, fuzzy.right.y = NULL, silent = FALSE, ... )
fuzzylm( formula, data, method = "plrls", fuzzy.left.x = NULL, fuzzy.right.x = NULL, fuzzy.left.y = NULL, fuzzy.right.y = NULL, silent = FALSE, ... )
formula |
a model formula. |
data |
a data.frame, containing the variables used in formula. |
method |
method for fitting of the fuzzy linear model. |
fuzzy.left.x |
character string vector specifying column name(s) with the left spread of the fuzzy independent variable(s). |
fuzzy.right.x |
character string vector specifying column name(s) with the right spread of the fuzzy independent variable(s). |
fuzzy.left.y |
character string vector specifying column name(s) with the left spread of the fuzzy dependent variable. |
fuzzy.right.y |
character string vector specifying column name(s) with the right spread of the fuzzy dependent variable. |
silent |
logical whether warnings should be printed. |
... |
additional parameters used by specific methods, check functions
|
The implemented methods include plrls
(Lee and Tanaka 1999) and
bfrl
(Skrabanek et al. 2021) for fitting the fuzzy linear
regression from the crisp input data, and fls
(Diamond 1988), oplr
(Hung and Yang 2006), moflr
(Nasrabadi et al. 2005) and plr
(Tanaka et al. 1989) methods for
triangular fuzzy numbers.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Diamond, P. (1988) Fuzzy least squares. Information Sciences 46(3): 141-157.
Hung, W.-L. and Yang, M.-S. (2006) An omission approach for detecting outliers in fuzzy regression models. Fuzzy Sets and Systems 157: 3109-3122.
Lee, H. and Tanaka, H. (1999) Fuzzy approximations with non-symmetric fuzzy parameters in fuzzy regression analysis. Journal of the Operations Research Society Japan 42: 98-112.
Nasrabadi, M. M., Nasrabadi, E. and Nasrabady, A. R. (2005) Fuzzy linear regression analysis: a multi-objective programming approach. Applied Mathematics and Computation 163: 245-251.
Skrabanek, P., Marek, J. and Pozdilkova, A. (2021) Boscovich Fuzzy Regression Line. Mathematics 9: 685.
Tanaka, H., Hayashi, I. and Watada, J. (1989) Possibilistic linear regression analysis for fuzzy data. European Journal of Operational Research 40: 389-396.
Zeng, W., Feng, Q. and Li, J. (2017) Fuzzy least absolute linear regression. Applied Soft Computing 52: 1009-1019.
data(fuzzydat) fuzzylm(y ~ x, data = fuzzydat$lee, method = "plrls") ## Not run: # returns an error due to the incorrect number of spreads fuzzylm(y ~ x, data = fuzzydat$dia, method = "fls", fuzzy.left.y = "yl") ## End(Not run) # use the same column name for the left and right spread, when the method requests # non-symmetric fuzzy numbers, but the data specify symmetric fuzzy numbers fuzzylm(y ~ x, data = fuzzydat$dia, method = "fls", fuzzy.left.y = "yl", fuzzy.right.y = "yl")
data(fuzzydat) fuzzylm(y ~ x, data = fuzzydat$lee, method = "plrls") ## Not run: # returns an error due to the incorrect number of spreads fuzzylm(y ~ x, data = fuzzydat$dia, method = "fls", fuzzy.left.y = "yl") ## End(Not run) # use the same column name for the left and right spread, when the method requests # non-symmetric fuzzy numbers, but the data specify symmetric fuzzy numbers fuzzylm(y ~ x, data = fuzzydat$dia, method = "fls", fuzzy.left.y = "yl", fuzzy.right.y = "yl")
Calculates mean error rate based on Diamond's distance of two variables representing triangular fuzzy numbers, where one is the response variable and the other is the prediction from a fuzzy regression model.
GOF(object, sc = 1e-06)
GOF(object, sc = 1e-06)
object |
a |
sc |
scaling constant used for numerical stability when spreads are equal to zero. |
The Diamond's distance of two triangular fuzzy numbers is sum of squared differences of the core and both support values of the fuzzy numbers.
A numeric.
Diamond P. (1988) Fuzzy least squares. Information Sciences 46(3): 141-157.
Wang N., Zhang W.-X., Mei C.-L. (2007) Fuzzy nonparametric regression based on local linear smoothing technique. Information Sciences 177: 3882-3900.
data(bats) f <- fuzzylm(temperature ~ MAST, data = bats) GOF(f)
data(bats) f <- fuzzylm(temperature ~ MAST, data = bats) GOF(f)
This function calculates fuzzy regression coeficients using the multi-objective fuzzy linear regression (MOFLR) method developed by Nasrabadi et al. (2005) that combines the least squares approach (fitting of a central tendency) with the possibilistic approach (fitting of spreads) when approximating an observed linear dependence by a fuzzy linear model.
moflr(x, y, omega = 0.5, sc = 1e-06)
moflr(x, y, omega = 0.5, sc = 1e-06)
x |
matrix of n independent variable values, followed by n spreads. First column is exptected to consist of ones, representing intercept. Missing values not allowed. |
y |
two column matrix of dependent variable values and the respective spread. Method assumes symmetric triangular fuzzy input, so the second spread (if present) is ignored. Missing values not allowed. |
omega |
a scalar that specifies weight that determines trade-off of
between outliers penalization and data fitting in interval |
sc |
scaling constant used to input random spreads for the intercept, necessary for computational stability. |
The function input expects both the response and the predictors in form of
symmetric fuzzy numbers. The
prediction returns symmetric triangular fuzzy number coefficients.
The Nasrabadi et al.'s method can process datasets with multiple outliers. Values
omega>0.5
decrease weight of outliers on the solution.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "moflr"
.
Nasrabadi, M. M., Nasrabadi, E. and Nasrabady, A. R. (2005) Fuzzy linear regression analysis: a multi-objective programming approach. Applied Mathematics and Computation 163: 245-251.
data(fuzzydat) fuzzylm(y~x, fuzzydat$nas, "moflr", "xl", , "yl")
data(fuzzydat) fuzzylm(y~x, fuzzydat$nas, "moflr", "xl", , "yl")
The function calculates fuzzy regression coeficients using the possibilistic linear regression with an outlier omission approach method (OPLR) developed by Hung and Yang (2006) that combines the least squares approach (fitting of a central tendency) with the possibilistic approach (fitting of spreads) when approximating an observed linear dependence by a fuzzy linear model.
oplr(x, y, h = 0)
oplr(x, y, h = 0)
x |
matrix with the independent variables observations. The first column is related to the intercept, so it consists of ones. Missing values not allowed. |
y |
two column matrix of the dependent variable values and the respective spread. Method assumes symmetric triangular fuzzy input, so the second spread (if present) is ignored. Missing values not allowed. |
h |
a scalar value in interval |
The function input expects symmetric fuzzy response and crisp predictors. The
prediction returns symmetric triangular fuzzy number coefficients.
The OPLR method can detect one outlier in the data that is farther than
1.5 * IQR
from either quartile.
The h-level is a degree of fitting chosen by the decision maker.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "oplr"
.
Hung, W.-L. and Yang, M.-S. (2006) An omission approach for detecting outliers in fuzzy regression models. Fuzzy Sets and Systems 157: 3109-3122.
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$hun, "oplr", , , "yl")
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$hun, "oplr", , , "yl")
Plots the data and the central tendency with spreads of a fuzzy linear regression. For multiple regression, allows choice of which variable to display. Optionally colors the polygon for the regression.
## S3 method for class 'fuzzylm' plot( x, y = NULL, choice = 1, res = 2, col.fuzzy = NA, length = 0.05, angle = 90, main = "method", xlab = NULL, ylab = NULL, ... )
## S3 method for class 'fuzzylm' plot( x, y = NULL, choice = 1, res = 2, col.fuzzy = NA, length = 0.05, angle = 90, main = "method", xlab = NULL, ylab = NULL, ... )
x |
a |
y |
NULL for plotting a |
choice |
an integer or character string specifying which explanatory variable to plot in a partial fit of a multiple regression. |
res |
an integer |
col.fuzzy |
color for shading of the regression plot. |
length |
length of the edges of the arrow head (in inches). |
angle |
angle from the shaft of the arrow to the edge of the arrow head. |
main |
a main title for the plot. Default title specifies method used to fit the model. |
xlab |
a label for the x axis, defaults to a description of x. |
ylab |
a label for the y axis, defaults to a description of y. |
... |
additional graphical parameters. |
Silently plots the data. Fuzzy numbers are plotted with points for the central value and arrows specifying spreads.
In case the x
object contains a multiple fuzzy regression, the function plots
a partial fit for one explanatory variable.
No return value, called for side effects.
data(fuzzydat) f = fuzzylm(y ~ x, fuzzydat$lee) plot(f) plot(f, res = 20, col.fuzzy = "red")
data(fuzzydat) f = fuzzylm(y ~ x, fuzzydat$lee) plot(f) plot(f, res = 20, col.fuzzy = "red")
The function calculates fuzzy regression coeficients using the possibilistic linear
regression method (PLR) developed by Tanaka et al. (1989). Specifically, the
min
problem is implemented in this function.
plr(x, y, h = 0)
plr(x, y, h = 0)
x |
matrix of n independent variable observations. The first column is related to the intercept, so it consists of ones. Missing values not allowed. |
y |
two column matrix of dependent variable values and the respective spread. Method assumes symmetric triangular fuzzy input, so the second spread (if present) is ignored. Missing values not allowed. |
h |
a scalar value in interval |
The function input expects the response in form of a symmetric fuzzy number and the predictors as crisp numbers. The prediction returns symmetric triangular fuzzy number coefficients.
The h-level is a degree of fitting chosen by the decision maker.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "plr"
.
Tanaka H., Hayashi I. and Watada J. (1989) Possibilistic linear regression analysis for fuzzy data. European Journal of Operational Research 40: 389-396.
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$tan, "plr", , , "yl", "yr")
data(fuzzydat) fuzzylm(y ~ x, fuzzydat$tan, "plr", , , "yl", "yr")
The function calculates fuzzy regression coeficients using the possibilistic linear regression with least squares method developed by Lee and Tanaka (1999) that combines the least squares approach (fitting of a central tendency) with the possibilistic approach (fitting of spreads) when approximating an observed linear dependence by a fuzzy linear model.
plrls(x, y, h = 0, k1 = 1, k2 = 1, epsilon = 1e-05)
plrls(x, y, h = 0, k1 = 1, k2 = 1, epsilon = 1e-05)
x |
two column matrix with the second column representing independent variable observations. The first column is related to the intercept, so it consists of ones. Missing values not allowed. |
y |
one column matrix of dependent variable values, missing values not allowed. |
h |
a scalar value in interval |
k1 |
weight coefficient for the centeral tendency. |
k2 |
weight coefficient for the spreads. |
epsilon |
small positive number that supports search for the optimal solution. |
The function input expects crisp numbers of both the explanatory and response variables, and the prediction returns non-symmetric triangular fuzzy number coefficients.
The h-level is a degree of fitting chosen by the decision maker.
Returns a fuzzylm
object that includes the model coefficients, limits
for data predictions from the model and the input data.
Preferred use is through the fuzzylm
wrapper function with argument
method = "plrls"
.
Lee, H. and Tanaka, H. (1999) Fuzzy approximations with non-symmetric fuzzy parameters in fuzzy regression analysis. Journal of the Operations Research Society Japan 42: 98-112.
x <- matrix(c(rep(1, 15), rep(1:3, each = 5)), ncol = 2) y <- matrix(c(rnorm(5, 1), rnorm(5, 2), rnorm(5, 3)), ncol = 1) plrls(x = x, y = y)
x <- matrix(c(rep(1, 15), rep(1:3, each = 5)), ncol = 2) y <- matrix(c(rnorm(5, 1), rnorm(5, 2), rnorm(5, 3)), ncol = 1) plrls(x = x, y = y)
Predicts the central tendency and spreads from a fuzzy linear regression model.
## S3 method for class 'fuzzylm' predict(object, newdata, ...)
## S3 method for class 'fuzzylm' predict(object, newdata, ...)
object |
a |
newdata |
an optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. |
... |
further arguments passed to or from other methods. |
fuzzylm
object with newdata
replacing the element x
and
predictions in triangular fuzzy number format representing the central values
and left and right spreads replacing the element y
.
data(fuzzydat) f <- fuzzylm(y ~ x, data = fuzzydat$lee) predict(f)
data(fuzzydat) f <- fuzzylm(y ~ x, data = fuzzydat$lee) predict(f)
Prints the call and coefficients from the fuzzylm
object.
## S3 method for class 'fuzzylm' print(x, ...)
## S3 method for class 'fuzzylm' print(x, ...)
x |
a |
... |
further arguments passed to or from other methods. |
No return value, called for side effects.
x <- rep(1:3, each = 5) y <- c(rnorm(5, 1), rnorm(5, 2), rnorm(5, 3)) dat <- data.frame(x = x, y = y) f <- fuzzylm(y ~ x, dat) f
x <- rep(1:3, each = 5) y <- c(rnorm(5, 1), rnorm(5, 2), rnorm(5, 3)) dat <- data.frame(x = x, y = y) f <- fuzzylm(y ~ x, dat) f
Prints the models for the central tendency and spreads from the fuzzylm
object.
## S3 method for class 'summary.fuzzylm' print(x, ...)
## S3 method for class 'summary.fuzzylm' print(x, ...)
x |
a summary of a |
... |
further arguments passed to or from other methods. |
No return value, called for side effects.
x <- rep(1:3, each = 5) y <- c(rnorm(5, 1), rnorm(5, 2), rnorm(5, 3)) dat <- data.frame(x = x, y = y) f <- fuzzylm(y ~ x, dat) sum.f <- summary(f) sum.f
x <- rep(1:3, each = 5) y <- c(rnorm(5, 1), rnorm(5, 2), rnorm(5, 3)) dat <- data.frame(x = x, y = y) f <- fuzzylm(y ~ x, dat) sum.f <- summary(f) sum.f
Calculates product of two triangular fuzzy numbers defined as a central value, left and right spread.
prodFuzzy(x, y)
prodFuzzy(x, y)
x |
a numeric vector of length three, specifying a triangular fuzzy number as its central value, left and right spread. |
y |
a numeric vector of length three, specifying a triangular fuzzy number as its central value, left and right spread. |
Returns a numeric vector, representing a triangular fuzzy number.
x <- c(1, 0.2, 0.2) y <- c(2, 0.2, 0.2) prodFuzzy(x = x, y = y)
x <- c(1, 0.2, 0.2) y <- c(2, 0.2, 0.2) prodFuzzy(x = x, y = y)
Calculates product of a real number scalar and a triangular fuzzy number defined as a central value, left and right spread.
prodSfuzzy(x, y)
prodSfuzzy(x, y)
x |
numeric vector of length one. |
y |
a numeric vector of length three, specifying a triangular fuzzy number as its central value, left and right spread. |
Note that if x < 0
the left and right spread will be reversed.
Returns a numeric vector, representing a triangular fuzzy number.
x <- 2 y <- c(2, 0.2, 0.2) prodSfuzzy(x = x, y = y) x <- -2 prodSfuzzy(x = x, y = y)
x <- 2 y <- c(2, 0.2, 0.2) prodSfuzzy(x = x, y = y) x <- -2 prodSfuzzy(x = x, y = y)
Calculates a sum of two triangular fuzzy numbers defined as a central value, left and right spread.
sumFuzzy(x, y)
sumFuzzy(x, y)
x |
a numeric vector of length three, specifying a triangular fuzzy number as its central value, left and right spread. |
y |
a numeric vector of length three, specifying a triangular fuzzy number as its central value, left and right spread. |
Returns a numeric vector, representing a triangular fuzzy number.
x <- c(1, 0.1, 0.2) y <- c(2, 0.2, 0.2) sumFuzzy(x = x, y = y)
x <- c(1, 0.1, 0.2) y <- c(2, 0.2, 0.2) sumFuzzy(x = x, y = y)
Calculates the summary from the fuzzylm
object.
## S3 method for class 'fuzzylm' summary(object, ...)
## S3 method for class 'fuzzylm' summary(object, ...)
object |
a |
... |
additional parameters passed to and from other methods. |
Returns a list with models for the central tendency and spreads from the fuzzy linear regression, total error of fit of the model and a goodness-of-fit measure.
data(fuzzydat) f <- fuzzylm(y ~ x, fuzzydat$lee) sum.f <- summary(f) sum.f
data(fuzzydat) f <- fuzzylm(y ~ x, fuzzydat$lee) sum.f <- summary(f) sum.f
Calculates total error of fit of a fuzzy regression model based on the concept of difference in membership functions of triangular fuzzy numbers between the estimated and observed fuzzy dependent variables.
TEF(object, sc = 1e-06, ...)
TEF(object, sc = 1e-06, ...)
object |
a |
sc |
scaling constant used for numerical stability when spreads are equal to zero. |
... |
additional arguments passed to the |
Calculates , where
is the difference in
membership functions between two triangular fuzzy numbers. Here, between the
observation and the prediction from a fuzzy regression model
fuzzylm
.
A numeric with sum of pairwise differences between the triangular fuzzy numbers.
TEF
is not suitable for assessing fuzzy linear regression models that were
fitted from crisp input data. Such data will result in division by zero. The scaling
constant sc
numerically allows the calculation to proceed, but it is not
advisable. Use GOF
instead.
Kim B. and Bishu R. R. (1998) Evaluation of fuzzy linear regression models by comparing membership functions. Fuzzy Sets and Systems 100: 343-352.
data(fuzzydat) f <- fuzzylm(y ~ x, fuzzydat$lee) TEF(f)
data(fuzzydat) f <- fuzzylm(y ~ x, fuzzydat$lee) TEF(f)