PLFN: Simulate a random Piecewise Linear Fuzzy Number

Description Usage Arguments Value References See Also Examples

Description

This function is able to produce / simulate a Piecewise Linear Fuzzy Number (PLFN).

Usage

1
2
PLFN(knot.n, type = "PLFN", X.dist, X.dist.par, slX.dist, slX.dist.par, 
     srX.dist, srX.dist.par)

Arguments

knot.n

the number of knots; see package FuzzyNumbers for more details.

type

The possible values of this argument is type = c("Tri", "Tra", "PLFN", "PLFI") . In other words, this function returned one of following fuzzy numbers: (1) Triangular Fuzzy Number ( when type = "Tri" ), (2) Trapezoidal Fuzzy Number ( when type = "Tra" ), (3) Piecewise Linear Fuzzy Number ( when type = "PLFN" ), and (4) Piecewise Linear Fuzzy Interval ( when type = "PLFI" ).

X.dist

The distribution name of the random variable (for simulate the core of random fuzzy number) is determined by characteristic element T.dist. The names of distributions is similar to stats package.

X.dist.par

A vector of distribution parameters (for simulate the core of random fuzzy number) with considered ordering in stats package.

slX.dist

The distribution name of the random variable (for simulate the left spread value of random fuzzy number) is determined by characteristic element T.dist. The names of distributions is similar to stats package.

slX.dist.par

A vector of distribution parameters (for simulate the left spread value of random fuzzy number) with considered ordering in stats package.

srX.dist

The distribution name of the random variable (for simulate the right spread value of random fuzzy number) is determined by characteristic element T.dist. The names of distributions is similar to stats package.

srX.dist.par

A vector of distribution parameters (for simulate the right spread value of random fuzzy number) with considered ordering in stats package.

Value

Considering the type argument, this function returned/simulate/create one of following fuzzy numbers: (1) Triangular Fuzzy Number, (2) Trapezoidal Fuzzy Number, (3) Piecewise Linear Fuzzy Number, and (4) Piecewise Linear Fuzzy Interval.

References

Gagolewski, M., Caha, J. (2015) FuzzyNumbers Package: Tools to deal with fuzzy numbers in R. R package version 0.4-1, https://cran.r-project.org/web/packages=FuzzyNumbers

Gagolewski, M., Caha, J. (2015) A guide to the FuzzyNumbers package for R (FuzzyNumbers version 0.4-1) http://FuzzyNumbers.rexamine.com

See Also

DISTRIB FuzzyNumbers FuzzyNumbers.Ext.2 Calculator.LR.FNs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Example:  Let x ~~ ( X~N(3,0.2) ; s_X^l~Exp(3) ; s_X^r~U(0,2) )  

if(!require(FuzzyNumbers)){install.packages("FuzzyNumbers")}
library(FuzzyNumbers)

knot.n = 2
P <- PLFN( knot.n, type="Tri",
	     X.dist="norm", X.dist.par=c(3,.2),
	     slX.dist="exp", slX.dist.par=3,
	     srX.dist="unif", srX.dist.par=c(0,2)
	    )
P
plot(P, lwd=3, type="b")
abline( h=round((knot.n+1):0/(knot.n+1),4), v=alphacut(P, round((knot.n+1):0/(knot.n+1),4) ),
        lty=3, col=2  ) 


P <- PLFN( knot.n, type="Tra",
	     X.dist="norm", X.dist.par=c(3,1),
	     slX.dist="exp", slX.dist.par=3,
	     srX.dist="unif", srX.dist.par=c(0,2)
	    )
plot(P, lwd=3, type="b")
abline( h=round((knot.n+1):0/(knot.n+1),4), v=alphacut(P, round((knot.n+1):0/(knot.n+1),4) ),
                lty=3, col=2  ) 


knot.n = 2
P <- PLFN( knot.n,			#Defult:  type="PLFN" 
	     X.dist="norm", X.dist.par=c(3,1),
	     slX.dist="exp", slX.dist.par=3,
	     srX.dist="unif", srX.dist.par=c(0,2)
	    )
plot(P, lwd=3)
abline( h=round((knot.n+1):0/(knot.n+1),4), v=alphacut(P, round((knot.n+1):0/(knot.n+1),4) ),
        lty=3, col=2  ) 
#Try once again by knot.n=10


knot.n = 2
P <- PLFN( knot.n, type="PLFI",
	     X.dist="norm", X.dist.par=c(3,1),
	     slX.dist="exp", slX.dist.par=3,
	     srX.dist="unif", srX.dist.par=c(0,2)
	    )
plot(P, lwd=3, type="b")
abline( h=round((knot.n+1):0/(knot.n+1),4), v=alphacut(P, round((knot.n+1):0/(knot.n+1),4) ),
        lty=3, col=2  ) 

plot(P, type="b", col=2, lty=1, lwd=3, add=FALSE)
# Some of possible types are:
  #  "p" for points, 
  #  "l" for lines, 
  #  "b" for both, 
  #  "c" for the lines part alone of "b", 
  #  "o" for both over plotted, 
  #  "h" for histogram like (or high-density) vertical lines, 
  #  "s" for stair steps, 
  #  "S" for other steps, 
  #  "n" for no plotting. 


P
P["a1"] #First point of support
P["a2"] #First point of core
P["a3"] #End point of core
P["a4"] #End point of support

core(P)
supp(P)
alphacut(P, 0.5)
abline(h=.5, lty=3)

evaluate(P, 3.5)
round( evaluate(P, seq(0,4, by=.5)), 2)

Example output

Loading required package: FuzzyNumbers
Piecewise linear fuzzy number with 2 knot(s),
   support=[3.03052,4.86426],
      core=[3.06754,3.06754].
Piecewise linear fuzzy number with 2 knot(s),
   support=[2.72197,4.06896],
      core=[2.82578,2.90317].
[1] 2.721972
[1] 2.825778
[1] 2.903172
[1] 4.068961
[1] 2.825778 2.903172
[1] 2.721972 4.068961
           L        U
0.5 2.780864 3.920613
      3.5 
0.8016501 
 0.0  0.5  1.0  1.5  2.0  2.5  3.0  3.5  4.0 
0.00 0.00 0.00 0.00 0.00 0.00 0.97 0.80 0.17 

Sim.PLFN documentation built on May 2, 2019, 5:51 a.m.