Package 'agop'

Title: Aggregation Operators and Preordered Sets
Description: Tools supporting multi-criteria and group decision making, including variable number of criteria, by means of aggregation operators, spread measures, fuzzy logic connectives, fusion functions, and preordered sets. Possible applications include, but are not limited to, quality management, scientometrics, software engineering, etc.
Authors: Marek Gagolewski [aut, cre] , Anna Cena [ctb]
Maintainer: Marek Gagolewski <[email protected]>
License: LGPL (>= 3)
Version: 0.2.4
Built: 2024-11-06 04:25:54 UTC
Source: https://github.com/gagolews/agop

Help Index


Aggregation Operators and Preordered Sets Package for R

Description

Keywords: aggregation, bibliometrics, scientometrics, scientific impact, webometrics, preorders, binary relations, means, OWA, OWMax, OWMin, Hirsch's h-index, Egghe's g-index, variance, spread, decision making, fuzzy logic.

Acknowledgments: The development of the package in March-June 2013 was partially supported by the European Union from the resources of the European Social Fund, Project PO KL “Information technologies: Research and their interdisciplinary applications”, agreement UDA-POKL.04.01.01-00-051/10-00.

Author(s)

Marek Gagolewski [aut,cre],
Anna Cena [ctb]


Check If Two Vectors Are Comonotonic

Description

This functions determines if two vectors have a common ordering permutation.

Usage

check_comonotonicity(x, y, incompatible_lengths = NA)

Arguments

x

numeric vector

y

numeric vector

incompatible_lengths

single logical value, value to return iff lengths of x and y differ

Details

Two vectors x, y of equal length nn are comonotonic, if and only if there exists a permutation σ\sigma such that xσ(1)xσ(n)x_{\sigma(1)}\le \dots \le x_{\sigma(n)} and yσ(1)yσ(n)y_{\sigma(1)}\le \dots \le y_{\sigma(n)}. Thus, σ\sigma orders x and y simultaneously. Equivalently, x and y are comonotonic, iff (xixj)(yiyj)0(x_i-x_j)(y_i-y_j)\ge 0 for every i,j.

If there are missing values in x or y, the function returns NA.

Currently, the implemented algorithm has O(n2)O(n^2) time complexity.

Value

Returns a single logical value.

References

Grabisch M., Marichal J.-L., Mesiar R., Pap E., Aggregation functions, Cambridge University Press, 2009.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other binary_relations: pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


D2OWA Operators

Description

Computes the D2OWA operator, i.e., the normalized L2 distance between a numeric vector and an OWA operator.

Usage

d2owa_checkwts(w)

d2owa(x, w = rep(1/length(x), length(x)))

Arguments

w

numeric vector of the same length as x, with elements in [0,1][0,1], and such that iwi=1\sum_i w_i=1; weights

x

numeric vector to be aggregated

Details

D2OWA is a symmetric spread measure. It is defined as d2owa(x) == sqrt(mean((x-owa(x,w))^2)). Not all weights, however, generate a proper function of this kind; d2owa_checkwts may be used to check that. For d2owa, if w is not appropriate, an error is thrown.

w is automatically normalized so that its elements sum up to 1.

Value

For d2owa, a single numeric value is returned. On the other hand, d2owa_checkwts returns a single logical value.

References

Gagolewski M., Spread measures and their relation to aggregation functions, European Journal of Operational Research 241(2), 2015, pp. 469-477. doi:10.1016/j.ejor.2014.08.034

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

Yager R.R., On ordered weighted averaging aggregation operators in multicriteria decision making, IEEE Transactions on Systems, Man, and Cybernetics 18(1), 1988, pp. 183-190.


Parameter Estimation in the Discretized Pareto-Type II Distribution Family (MLE)

Description

Finds the maximum likelihood estimator of the Discretized Pareto Type-II distribution's shape parameter kk and scale parameter ss.

Usage

dpareto2_estimate_mle(
  x,
  k0 = 1,
  s0 = 1,
  kmin = 1e-04,
  smin = 1e-04,
  kmax = 100,
  smax = 100
)

Arguments

x

a non-negative numeric vector

k0, s0

initial points for the L-BFGS-B method

kmin, kmax

lower and upper bound for the shape parameter

smin, smax

lower and upper bound for the scale parameter

Details

Note that the maximum of the likelihood function might not exist for some input vectors. This estimator may have a large mean squared error.

Value

Returns a numeric vector with the following named components:

  • k - estimated parameter of shape

  • s - estimated parameter of scale

or c(NA, NA) if the maximum of the likelihood function could not be found.

See Also

Other DiscretizedPareto2: rdpareto2()


Anderson-Darling Test for Exponentiality

Description

Performs an approximate Anderson-Darling goodness-of-fit test, which verifies the null hypothesis: Data follow an exponential distribution.

Usage

exp_test_ad(x)

Arguments

x

a non-negative numeric vector of data values

Details

Sample size should be not less than 3. Missing values are removed from x before applying the procedure.

The p-value is approximate: its distribution has been estimated by taking 2500000 MC samples. For performance and space reasons, the estimated distribution is recreated by a spline interpolation on a fixed number of points. As a result, the resulting p-value distribution might not necessarily be uniform for p>>0.5.

Value

A list of the class htest is returned, just like in many other testing methods, see, e.g., ks.test.

References

Anderson T.W., Darling D.A., A Test of Goodness-of-Fit, Journal of the American Statistical Association 49, 1954, pp. 765-769.

See Also

pexp

Other Tests: pareto2_test_ad(), pareto2_test_f()


Fuzzy Implications

Description

Various fuzzy implications Each of these is a fuzzy logic generalization of the classical implication operation.

Usage

fimplication_minimal(x, y)

fimplication_maximal(x, y)

fimplication_kleene(x, y)

fimplication_lukasiewicz(x, y)

fimplication_reichenbach(x, y)

fimplication_fodor(x, y)

fimplication_goguen(x, y)

fimplication_goedel(x, y)

fimplication_rescher(x, y)

fimplication_weber(x, y)

fimplication_yager(x, y)

Arguments

x

numeric vector with elements in [0,1][0,1]

y

numeric vector of the same length as x, with elements in [0,1][0,1]

Details

A function I:[0,1]×[0,1][0,1]I: [0,1]\times [0,1]\to [0,1] is a fuzzy implication if for all x,y,x,y[0,1]x,y,x',y'\in [0,1] it holds: (a) if xxx\le x', then I(x,y)I(x,y)I(x, y)\ge I(x', y); (b) if yyy\le y', then I(x,y)I(x,y)I(x, y)\le I(x, y'); (c) I(1,1)=1I(1, 1)=1; (d) I(0,0)=1I(0, 0)=1; (e) I(1,0)=0I(1, 0)=0.

The minimal fuzzy implication is given by I0(x,y)=1I_0(x, y)=1 iff x=0x=0 or y=1y=1, and 0 otherwise.

The maximal fuzzy implication is given by I1(x,y)=0I_1(x, y)=0 iff x=1x=1 and y=0y=0, and 1 otherwise.

The Kleene-Dienes fuzzy implication is given by IKD(x,y)=max(1x,y)I_{KD}(x, y)=max(1-x, y).

The Lukasiewicz fuzzy implication is given by IL(x,y)=min(1x+y,1)I_{L}(x, y)=min(1-x+y, 1).

The Reichenbach fuzzy implication is given by IRB(x,y)=1x+xyI_{RB}(x, y)=1-x+xy.

The Fodor fuzzy implication is given by IF(x,y)=1I_F(x, y)=1 iff xyx\le y, and max(1x,y)max(1-x, y) otherwise.

The Goguen fuzzy implication is given by IGG(x,y)=1I_{GG}(x, y)=1 iff xyx\le y, and y/xy/x otherwise.

The Goedel fuzzy implication is given by IGD(x,y)=1I_{GD}(x, y)=1 iff xyx\le y, and yy otherwise.

The Rescher fuzzy implication is given by IRS(x,y)=1I_{RS}(x, y)=1 iff xyx\le y, and 00 otherwise.

The Weber fuzzy implication is given by IW(x,y)=1I_{W}(x, y)=1 iff x<1x<1, and yy otherwise.

The Yager fuzzy implication is given by IY(x,y)=1I_{Y}(x, y)=1 iff x=0x=0 and y=0y=0, and yxy^x otherwise.

Value

Numeric vector of the same length as x and y. The ith element of the resulting vector gives the result of calculating I(x[i], y[i]).

References

Klir G.J, Yuan B., Fuzzy sets and fuzzy logic. Theory and applications, Prentice Hall PTR, New Jersey, 1995.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other fuzzy_logic: fnegation_yager(), tconorm_minimum(), tnorm_minimum()


Fuzzy Negations

Description

Various fuzzy negations. Each of these is a fuzzy logic generalization of the classical negation operation.

Usage

fnegation_yager(x)

fnegation_classic(x)

fnegation_minimal(x)

fnegation_maximal(x)

Arguments

x

numeric vector with elements in [0,1][0,1]

Details

A function N:[0,1][0,1]N: [0,1]\to [0,1] is a fuzzy implication if for all x,y[0,1]x,y\in [0,1] it holds: (a) if xyx\le y, then N(x)N(y)N(x)\ge N(y); (b) N(1)=0N(1)=0; (c) N(0)=1N(0)=1.

The classic fuzzy negation is given by NC(x)=1xN_C(x)=1-x.

The Yager fuzzy negation is given by NY(x)=sqrt(1x2)N_Y(x)=sqrt(1-x^2).

The minimal fuzzy negation is given by N0(x,y)=1N_0(x,y)=1 iff x=0x=0, and 00 otherwise.

The maximal fuzzy negation is given by N1(x,y)=1N_1(x,y)=1 iff x<1x<1, and 00 otherwise.

Value

Numeric vector of the same length as x. The ith element of the resulting vector gives the result of calculating N(x[i]).

References

Klir G.J, Yuan B., Fuzzy sets and fuzzy logic. Theory and applications, Prentice Hall PTR, New Jersey, 1995.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other fuzzy_logic: fimplication_minimal(), tconorm_minimum(), tnorm_minimum()


Egghe's g-index

Description

Given a sequence of nn non-negative numbers x=(x1,,xn)x=(x_1,\dots,x_n), where xixj0x_i \ge x_j \ge 0 for iji \le j, the gg-index (Egghe, 2006) for xx is defined as

G(x)=max{i=1,,n:j=1ixii2}G(x)=\max\{i=1,\dots,n: \sum_{j=1}^i x_i \ge i^2\}

if n1n \ge 1 and x11x_1 \ge 1, or G(x)=0G(x)=0 otherwise.

Usage

index_g(x)

index.g(x) # same as index_g(x), deprecated alias

index_g_zi(x)

Arguments

x

a non-negative numeric vector

Details

index.g is a (deprecated) alias for index_g.

Note that index_g is not a zero-insensitive impact function, see Examples section. index_g_zi is its zero-sensitive variant: it assumes that the aggregated vector is padded with zeros.

If a non-increasingly sorted vector is given, the function has O(n) run-time.

For historical reasons, this function is also available via an alias, index.g [but its usage is deprecated].

Value

a single numeric value

References

Egghe L., Theory and practise of the g-index, Scientometrics 69(1), 2006, pp. 131-152.

Mesiar R., Gagolewski M., H-index and other Sugeno integrals: Some defects and their compensation, IEEE Transactions on Fuzzy Systems 24(6), 2016, pp. 1668-1672. doi:10.1109/TFUZZ.2016.2516579

Gagolewski M., Mesiar R., Monotone measures and universal integrals in a uniform framework for the scientific impact assessment problem, Information Sciences 263, 2014, pp. 166-174. doi:10.1016/j.ins.2013.12.004

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other impact_functions: index_h(), index_lp(), index_maxprod(), index_rp(), index_w(), pord_weakdom()

Examples

sapply(list(c(9), c(9,0), c(9,0,0), c(9,0,0,0)), index_g) # not a zero-sensitive agop

Hirsch's h-index

Description

Given a sequence of nn non-negative numbers x=(x1,,xn)x=(x_1,\dots,x_n), where xixj0x_i \ge x_j \ge 0 for iji \le j, the hh-index (Hirsch, 2005) for xx is defined as

H(x)=max{i=1,,n:xii}H(x)=\max\{i=1,\dots,n: x_i \ge i\}

if n1n \ge 1 and x11x_1 \ge 1, or H(x)=0H(x)=0 otherwise.

Usage

index_h(x)

index.h(x) # same as index_h(x), deprecated alias

Arguments

x

a non-negative numeric vector

Details

If a non-increasingly sorted vector is given, the function has O(n) run-time.

For historical reasons, this function is also available via an alias, index.h [but its usage is deprecated].

See index_rp and owmax for natural generalizations.

The h-index is the same as the discrete Sugeno integral of x w.r.t. the counting measure (see Torra, Narukawa, 2008).

Value

a single numeric value

References

Hirsch J.E., An index to quantify individual's scientific research output, Proceedings of the National Academy of Sciences 102(46), 2005, pp. 16569-16572.

Mesiar R., Gagolewski M., H-index and other Sugeno integrals: Some defects and their compensation, IEEE Transactions on Fuzzy Systems 24(6), 2016, pp. 1668-1672. doi:10.1109/TFUZZ.2016.2516579

Gagolewski M., Mesiar R., Monotone measures and universal integrals in a uniform framework for the scientific impact assessment problem, Information Sciences 263, 2014, pp. 166-174. doi:10.1016/j.ins.2013.12.004

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

Sugeno M., Theory of fuzzy integrals and its applications, PhD thesis, Tokyo Institute of Technology, 1974.

Torra V., Narukawa Y., The h-index and the number of citations: Two fuzzy integrals, IEEE Transactions on Fuzzy Systems 16(3), 2008, pp. 795-797.

See Also

Other impact_functions: index_g(), index_lp(), index_maxprod(), index_rp(), index_w(), pord_weakdom()

Examples

authors <- list(  # a list of numeric sequences
                  # (e.g. citation counts of the articles
                  # written by some authors)
    "A" =c(23,21,4,2,1,0,0),
    "B" =c(11,5,4,4,3,2,2,2,2,2,1,1,1,0,0,0,0),
    "C" =c(53,43,32,23,14,13,12,8,4,3,2,1,0)
 )
index_h(authors$A)
sapply(authors, index_h)

The l_p-index

Description

Given a sequence of nn non-negative numbers x=(x1,,xn)x=(x_1,\dots,x_n), where xixjx_i \ge x_j for iji \le j, the lpl_p-index for p=p=\infty equals to

lp(x)=argmax(i,xi),i=1,,n{ixi}l_p(x)=\arg\max_{(i,x_i), i=1,\dots,n} \{ i x_i \}

if n1n \ge 1, or l(x)=0l_\infty(x)=0 otherwise. Note that if (i,xi)=l(x)(i,x_i)=l_\infty(x), then

MAXPROD(x)=prod(l(x))=ixi,MAXPROD(x) = \mathtt{prod}(l_\infty(x)) = i x_i,

where MAXPRODMAXPROD is the index proposed in (Kosmulski, 2007), see index_maxprod. Moreover, this index corresponds to the Shilkret integral of xx w.r.t. some monotone measure, cf. (Gagolewski, Debski, Nowakiewicz, 2013).

For the definition of the lpl_p-index for p<p < \infty we refer to (Gagolewski, Grzegorzewski, 2009a).

Usage

index_lp(x, p = Inf, projection = prod)

index.lp(x, p = Inf, projection = prod)  # deprecated alias

Arguments

x

a non-negative numeric vector

p

index order, p[1,]p \in [1,\infty]; defaults \infty (Inf).

projection

function

Details

The lpl_p-index, by definition, is not an impact function, as it produces 2 numeric values. Thus, it should be projected to one dimension. However, you may set the projection argument to identity so as to obtain the 2-dimensional index

If a non-increasingly sorted vector is given, the function has O(n) run-time for any pp, see (Gagolewski, Debski, Nowakiewicz, 2013).

For historical reasons, this function is also available via an alias, index.lp [but its usage is deprecated].

Value

result of projection(c(i,xii, x_i))

References

Gagolewski M., Grzegorzewski P., A geometric approach to the construction of scientific impact indices, Scientometrics 81(3), 2009a, pp. 617-634.

Gagolewski M., Debski M., Nowakiewicz M., Efficient Algorithm for Computing Certain Graph-Based Monotone Integrals: the lp-Indices, In: Mesiar R., Bacigal T. (Eds.), Proc. Uncertainty Modelling, STU Bratislava, ISBN:978-80-227-4067-8, 2013, pp. 17-23.

Kosmulski M., MAXPROD - A new index for assessment of the scientific output of an individual, and a comparison with the h-index, Cybermetrics 11(1), 2007.

Shilkret, N., Maxitive measure and integration, Indag. Math. 33, 1971, pp. 109-116.

See Also

Other impact_functions: index_g(), index_h(), index_maxprod(), index_rp(), index_w(), pord_weakdom()

Examples

x <- runif(100, 0, 100)
index.lp(x, Inf, identity)  # two-dimensional value, can not be used
                            # directly in the analysis
index.lp(x, Inf, prod)      # the MAXPROD-index (one-dimensional) [default]

Kosmulski's MAXPROD-index

Description

Given a sequence of nn non-negative numbers x=(x1,,xn)x=(x_1,\dots,x_n), where xixj0x_i \ge x_j \ge 0 for iji \le j, the MAXPROD-index (Kosmulski, 2007) for xx is defined as

MAXPROD(x)=max{ixi:i=1,,n}MAXPROD(x)=\max\{i x_i: i=1,\dots,n\}

Usage

index_maxprod(x)

Arguments

x

a non-negative numeric vector

Details

If a non-increasingly sorted vector is given, the function has O(n) run-time.

The MAXPROD index is the same as the discrete Shilkret integral of x w.r.t. the counting measure.

See index_lp for a natural generalization.

Value

a single numeric value

References

Kosmulski M., MAXPROD - A new index for assessment of the scientific output of an individual, and a comparison with the h-index, Cybermetrics 11(1), 2007.

Mesiar R., Gagolewski M., H-index and other Sugeno integrals: Some defects and their compensation, IEEE Transactions on Fuzzy Systems 24(6), 2016, pp. 1668-1672. doi:10.1109/TFUZZ.2016.2516579

Gagolewski M., Mesiar R., Monotone measures and universal integrals in a uniform framework for the scientific impact assessment problem, Information Sciences 263, 2014, pp. 166-174. doi:10.1016/j.ins.2013.12.004

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other impact_functions: index_g(), index_h(), index_lp(), index_rp(), index_w(), pord_weakdom()


The r_p-index

Description

Given a sequence of nn non-negative numbers x=(x1,,xn)x=(x_1,\dots,x_n), where xixjx_i \ge x_j for iji \le j, the rpr_p-index for p=p=\infty equals to

rp(x)=maxi=1,,n{min{i,xi}}r_p(x)=\max_{i=1,\dots,n} \{ \min\{i,x_i\} \}

if n1n \ge 1, or r(x)=0r_\infty(x)=0 otherwise. That is, it is equivalent to a particular OWMax operator, see owmax.

For the definition of the rpr_p-index for p<p < \infty we refer to (Gagolewski, Grzegorzewski, 2009).

Usage

index_rp(x, p = Inf)

index.rp(x, p = Inf) # same as index_rp(x, p), deprecated alias

Arguments

x

a non-negative numeric vector

p

index order, p[1,]p \in [1,\infty]; defaults \infty (Inf).

Details

Note that if x1,,xnx_1,\dots,x_n are integers, then

r(x)=H(x),r_\infty(x)=H(x),

where HH is the hh-index (Hirsch, 2005) and

r1(x)=W(x),r_1(x)=W(x),

where WW is the ww-index (Woeginger, 2008), see index_h and index_w.

If a non-increasingly sorted vector is given, the function has O(n) run-time.

For historical reasons, this function is also available via an alias, index.rp [but its usage is deprecated].

Value

a single numeric value

References

Gagolewski M., Grzegorzewski P., A geometric approach to the construction of scientific impact indices, Scientometrics 81(3), 2009, pp. 617-634.

Hirsch J.E., An index to quantify individual's scientific research output, Proceedings of the National Academy of Sciences 102(46), 2005, pp. 16569-16572.

Woeginger G.J., An axiomatic characterization of the Hirsch-index, Mathematical Social Sciences 56(2), 2008, pp. 224-232.

See Also

Other impact_functions: index_g(), index_h(), index_lp(), index_maxprod(), index_w(), pord_weakdom()

Examples

x <- runif(100, 0, 100);
index.rp(x);            # the r_oo-index
floor(index.rp(x));     # the h-index
index.rp(floor(x), 1);  # the w-index

Woeginger's w-index

Description

Given a sequence of nn non-negative numbers x=(x1,,xn)x=(x_1,\dots,x_n), where xixj0x_i \ge x_j \ge 0 for iji \le j, the ww-index (Woeginger, 2008) for xx is defined as

W(x)=max{i=1,,n:xjij+1,j=1,,i}W(x)=\max\{i=1,\dots,n: x_{j}\ge i-j+1, \forall j=1,\dots,i\}

Usage

index_w(x)

Arguments

x

a non-negative numeric vector

Details

If a non-increasingly sorted vector is given, the function has O(n) run-time.

See index_rp for a natural generalization.

Value

a single numeric value

References

Woeginger G. J., An axiomatic characterization of the Hirsch-index. Mathematical Social Sciences 56(2), 2008, pp. 224-232.

See Also

Other impact_functions: index_g(), index_h(), index_lp(), index_maxprod(), index_rp(), pord_weakdom()


WAM and OWA Operators

Description

Computes the Weighted Arithmetic Mean or the Ordered Weighted Averaging aggregation operator.

Usage

owa(x, w = rep(1/length(x), length(x)))

wam(x, w = rep(1/length(x), length(x)))

Arguments

x

numeric vector to be aggregated

w

numeric vector of the same length as x, with elements in [0,1][0,1], and such that iwi=1\sum_i w_i=1; weights

Details

The OWA operator is given by

OWAw(x)=i=1nwix(i)\mathsf{OWA}_\mathtt{w}(\mathtt{x})=\sum_{i=1}^{n} w_{i}\,x_{(i)}

where x(i)x_{(i)} denotes the ii-th smallest value in x.

The WAM operator is given by

WAMw(x)=i=1nwixi\mathsf{WAM}_\mathtt{w}(\mathtt{x})=\sum_{i=1}^{n} w_{i}\,x_{i}

If the elements in w do not sum up to 11, then they are normalized and a warning is generated.

Both functions by default return the ordinary arithmetic mean. Special cases of OWA include the trimmed mean (see mean) and Winsorized mean.

There is a strong, well-known connection between the OWA operators and the Choquet integrals.

Value

These functions return a single numeric value.

References

Choquet G., Theory of capacities, Annales de l'institut Fourier 5, 1954, pp. 131-295.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

Yager R.R., On ordered weighted averaging aggregation operators in multicriteria decision making, IEEE Transactions on Systems, Man, and Cybernetics 18(1), 1988, pp. 183-190.

See Also

Other aggregation_operators: owmax()


WMax, WMin, OWMax, and OWMin Operators

Description

Computes the (Ordered) Weighted Maximum/Minimum.

Usage

owmax(x, w = rep(Inf, length(x)))

owmin(x, w = rep(-Inf, length(x)))

wmax(x, w = rep(Inf, length(x)))

wmin(x, w = rep(-Inf, length(x)))

Arguments

x

numeric vector to be aggregated

w

numeric vector of the same length as x; weights

Details

The OWMax operator is given by

OWMaxw(x)=i=1nwix(i)\mathsf{OWMax}_\mathtt{w}(\mathtt{x})=\bigvee_{i=1}^{n} w_{i}\wedge x_{(i)}

where x(i)x_{(i)} denotes the ii-th smallest value in x.

The OWMin operator is given by

OWMinw(x)=i=1nwix(i)\mathsf{OWMin}_\mathtt{w}(\mathtt{x})=\bigwedge_{i=1}^{n} w_{i}\vee x_{(i)}

The WMax operator is given by

WMaxw(x)=i=1nwixi\mathsf{WMax}_\mathtt{w}(\mathtt{x})=\bigvee_{i=1}^{n} w_{i}\wedge x_{i}

The WMin operator is given by

WMinw(x)=i=1nwixi\mathsf{WMin}_\mathtt{w}(\mathtt{x})=\bigwedge_{i=1}^{n} w_{i}\vee x_{i}

OWMax and WMax by default return the greatest value in x and OWMin and WMin - the smallest value in x.

Classically, it is assumed that if we aggregate vectors with elements in [a,b][a,b], then the largest weight for OWMax should be equal to bb and the smallest for OWMin should be equal to aa.

There is a strong connection between the OWMax/OWMin operators and the Sugeno integrals w.r.t. some monotone measures. Additionally, it may be shown that the OWMax and OWMin classes are equivalent.

Moreover, index_h for integer data is a particular OWMax operator.

Value

These functions return a single numeric value.

References

Dubois D., Prade H., Testemale C., Weighted fuzzy pattern matching, Fuzzy Sets and Systems 28, 1988, pp. 313-331.

Dubois D., Prade H., Semantics of quotient operators in fuzzy relational databases, Fuzzy Sets and Systems 78(1), 1996, pp. 89-93.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

Sugeno M., Theory of fuzzy integrals and its applications, PhD thesis, Tokyo Institute of Technology, 1974.

See Also

Other aggregation_operators: owa()


Parameter Estimation in the Pareto Type-II Distribution Family (MLE)

Description

Finds the maximum likelihood estimator of the Pareto Type-II distribution's shape parameter kk and, if not given explicitly, scale parameter ss.

Usage

pareto2_estimate_mle(
  x,
  s = NA_real_,
  smin = 1e-04,
  smax = 20,
  tol = .Machine$double.eps^0.25
)

Arguments

x

a non-negative numeric vector

s

a-priori known scale parameter, s>0s>0 or NA if unknown (default)

smin

lower bound for the scale parameter

smax

upper bound for the scale parameter

tol

the desired accuracy (convergence tolerance)

Details

Note that if ss is not given, then the maximum of the likelihood function might not exist for some input vectors. This estimator may have a large mean squared error. Consider using pareto2_estimate_mmse.

For known ss, the estimator is unbiased.

Value

Returns a numeric vector with the following named components:

  • k - estimated parameter of shape

  • s - estimated (or known, see the s argument) parameter of scale

or c(NA, NA) if the maximum of the likelihood function could not be found.

See Also

Other Pareto2: pareto2_estimate_mmse(), pareto2_test_ad(), pareto2_test_f(), rpareto2()


Parameter Estimation in the Pareto Type-II Distribution Family (MMSE)

Description

Finds the MMS estimator of the Pareto Type-II distribution parameters using the Bayesian method (and the R code) developed by Zhang and Stevens (2009).

Usage

pareto2_estimate_mmse(x)

Arguments

x

a non-negative numeric vector

Value

Returns a numeric vector with the following named components:

  • k - estimated parameter of shape,

  • s - estimated parameter of scale.

References

Zhang J., Stevens M.A., A New and Efficient Estimation Method for the Generalized Pareto Distribution, Technometrics 51(3), 2009, pp. 316-325.

See Also

Other Pareto2: pareto2_estimate_mle(), pareto2_test_ad(), pareto2_test_f(), rpareto2()


Anderson-Darling Test for the Pareto Type-II Distribution

Description

Performs an approximate Anderson-Darling goodness-of-fit test, which verifies the null hypothesis: Data follow a Pareto-Type II distribution.

Usage

pareto2_test_ad(x, s = 1)

Arguments

x

a non-negative numeric vector of data values

s

the known scale parameter, s>0s>0

Details

We know that if XX follows a Pareto-Type II distribution with shape parameter kk, then log(1+X/s)log(1+X/s) follows an exponential distribution with parameter kk. Thus, this function transforms the input vector, and performs the same steps as exp_test_ad.

Value

A list of the class htest is returned, see exp_test_ad.

See Also

Other Pareto2: pareto2_estimate_mle(), pareto2_estimate_mmse(), pareto2_test_f(), rpareto2()

Other Tests: exp_test_ad(), pareto2_test_f()


Two-Sample F-test For Equality of Shape Parameters for Type II-Pareto Distributions

Description

Performs the F-test for the equality of shape parameters of two samples from Pareto type-II distributions with known and equal scale parameters, s>0s>0.

Usage

pareto2_test_f(
  x,
  y,
  s,
  alternative = c("two.sided", "less", "greater"),
  significance = NULL
)

Arguments

x

a non-negative numeric vector

y

a non-negative numeric vector

s

the known scale parameter, s>0s>0

alternative

indicates the alternative hypothesis and must be one of "two.sided" (default), "less", or "greater"

significance

significance level, 0<0<significance<1<1 or NULL. See the Value section for details

Details

Given two samples (X1,...,Xn)(X_1,...,X_n) i.i.d. P2(kx,s)P2(k_x,s) and (Y1,...,Ym)(Y_1,...,Y_m) i.i.d. P2(ky,s)P2(k_y,s) this test verifies the null hypothesis H0:kx=kyH_0: k_x=k_y against two-sided or one-sided alternatives, depending on the value of alternative. It is based on the test statistic T(X,Y)=ni=1mlog(1+Yi/m)mi=1nlog(1+Xi/n)T(X,Y)=\frac{n\sum_{i=1}^m\log(1+Y_i/m)}{m\sum_{i=1}^n\log(1+X_i/n)} which, under H0H_0, follows the Snedecor's F distribution with (2m,2n)(2m, 2n) degrees of freedom.

Note that for kx<kyk_x < k_y, then XX dominates YY stochastically.

Value

If significance is not NULL, then the list of class power.htest with the following components is yield in result:

  • statistic - the value of the test statistic.

  • result - either FALSE (accept null hypothesis) or TRUE (reject).

  • alternative - a character string describing the alternative hypothesis.

  • method - a character string indicating what type of test was performed.

  • data.name - a character string giving the name(s) of the data.

Otherwise, the list of class htest with the following components is yield in result:

  • statistic the value of the test statistic.

  • p.value the p-value of the test.

  • alternative a character string describing the alternative hypothesis.

  • method a character string indicating what type of test was performed.

  • data.name a character string giving the name(s) of the data.

See Also

Other Pareto2: pareto2_estimate_mle(), pareto2_estimate_mmse(), pareto2_test_ad(), rpareto2()

Other Tests: exp_test_ad(), pareto2_test_ad()


Draws a Graphical Representation of a Numeric Vector

Description

Draws a step function that represents a numeric vector with elements in [a,][a,\infty].

Usage

plot_producer(
  x,
  type = c("left.continuous", "right.continuous", "curve"),
  extend = FALSE,
  add = FALSE,
  pch = 1,
  col = 1,
  lty = 1,
  lwd = 1,
  cex = 1,
  col.steps = col,
  lty.steps = 2,
  lwd.steps = 1,
  xlab = "",
  ylab = "",
  main = "",
  xmarg = 10,
  xlim = c(0, length(x) * 1.2),
  ylim = c(a, max(x)),
  a = 0,
  ...
)

Arguments

x

non-negative numeric vector

type

character; 'left.continuous' (the default) or 'right.continuous' for step functions and 'curve' for a continuous step curve

extend

logical; should the plot be extended infinitely to the right? Defaults to FALSE

add

logical; indicates whether to start a new plot, FALSE by default

pch, col, lty, lwd, cex, xmarg

graphical parameters

col.steps, lty.steps, lwd.steps

graphical parameters, used only for type of 'left.continuous' and 'right.continuous' only

ylim, xlim, xlab, ylab, main, ...

additional graphical parameters, see plot.default

a

single numeric value

Details

In agop, a vector x=(x1,,xn)x=(x_1,\dots,x_n) can be represented by a step function defined for 0y<n0\le y<n and given by:

π(y)=x(ny+1+1)\pi(y)=x_{(n-\lfloor y+1\rfloor+1)}

(for type == 'right.continuous') or for 0<yn0< y\le n

π(y)=x(ny+1)\pi(y)=x_{(n-\lfloor y\rfloor+1)}

(for type == 'left.continuous', the default) or by a curve interpolating the points (0,x(n))(0, x_{(n)}), (1,x(n))(1, x_{(n)}), (1,x(n1))(1, x_{(n-1)}), (2,x(n1))(2, x_{(n-1)}), ..., (n,x(1))(n, x_{(1)}). Here, x(i)x_{(i)} denotes the ii-th smallest value in xx.

In bibliometrics, a step function of one of the two above-presented types is called a citation function.

For historical reasons, this function is also available via its alias, plot.citfun [but its usage is deprecated].

Value

nothing interesting

Examples

john_s <- c(11,5,4,4,3,2,2,2,2,2,1,1,1,0,0,0,0)
plot_producer(john_s, main="Smith, John", col="red")

Weak Dominance Relation (Preorder)

Description

Checks whether a numeric vector of arbitrary length is (weakly) dominated (elementwise) by another vector of the same length.

Usage

pord_nd(x, y, incompatible_lengths = NA)

Arguments

x

numeric vector with nonnegative elements

y

numeric vector with nonnegative elements

incompatible_lengths

single logical value, value to return iff lengths of x and y differ

Details

We say that a numeric vector x of length nxn_x is weakly dominated by y of length nyn_y iff

  1. nx=nyn_x=n_y and

  2. for all i=1,,nxi=1,\dots,n_x it holds xiyix_i\le y_i.

This relation is a preorder: it is reflexive (see rel_is_reflexive) and transitive (see rel_is_transitive), but not necessarily total (see rel_is_total). See rel_graph for a convenient function to calculate the relationship between all pairs of elements of a given set.

Such a preorder is tightly related to classical aggregation functions: each aggregation function is a morphism between weak-dominance-preordered set of vectors and the set of reals equipped with standard linear ordering.

Value

Returns a single logical value indicating whether x is weakly dominated by y.

References

Grabisch M., Marichal J.-L., Mesiar R., Pap E., Aggregation functions, Cambridge University Press, 2009.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other binary_relations: check_comonotonicity(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Compare Spread of Vectors (Preorder)

Description

This function determines whether one numeric vector has not greater spread than the other

Usage

pord_spread(x, y, incompatible_lengths = NA)

Arguments

x

numeric vector

y

numeric vector of the same length as x

incompatible_lengths

single logical value, value to return iff lengths of x and y differ

Details

We say that x of size nn is of no greater spread than y iff for all i,j=1,,ni,j=1,\dots,n such that xi>xjx_i>x_j it holds xixjyiyjllx_i-x_j\le y_i-y_jll. Such a preorder is used in the definition of a spread measure (see Gagolewski, 2015).

Note that the class of dispersion functions includes e.g. the sample variance (see var), standard veriation (see sd), range (see range and then diff), interquartile range (see IQR), median absolute deviation (see mad).

Value

The function returns a single logical value, which states whether x has no greater spread than y

References

Gagolewski M., Spread measures and their relation to aggregation functions, European Journal of Operational Research 241(2), 2015, pp. 469–477.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Weak Dominance Relation (Preorder) in the Producer Assessment Problem

Description

Checks whether a given numeric vector of arbitrary length is (weakly) dominated by another vector, possibly of different length, in terms of (sorted) elements' values and their number.

Usage

pord_weakdom(x, y)

Arguments

x

numeric vector with nonnegative elements

y

numeric vector with nonnegative elements

Details

We say that a numeric vector x of length nxn_x is weakly dominated by y of length nyn_y iff

  1. nxnyn_x\le n_y and

  2. for all i=1,,ni=1,\dots,n it holds x(nxi+1)y(nyi+1)x_{(n_x-i+1)}\le y_{(n_y-i+1)}.

This relation is a preorder: it is reflexive (see rel_is_reflexive) and transitive (see rel_is_transitive), but not necessarily total (see rel_is_total). See rel_graph for a convenient function to calculate the relationship between all pairs of elements of a given set.

Note that this dominance relation gives the same value for all permutations of input vectors' element. Such a preorder is tightly related to symmetric impact functions: each impact function is a morphism between weak-dominance-preordered set of vectors and the set of reals equipped with standard linear ordering (see Gagolewski, Grzegorzewski, 2011 and Gagolewski, 2013).

Value

Returns a single logical value indicating whether x is weakly dominated by y.

References

Gagolewski M., Grzegorzewski P., Possibilistic Analysis of Arity-Monotonic Aggregation Operators and Its Relation to Bibliometric Impact Assessment of Individuals, International Journal of Approximate Reasoning 52(9), 2011, pp. 1312-1324.

Gagolewski M., Scientific Impact Assessment Cannot be Fair, Journal of Informetrics 7(4), 2013, pp. 792-802.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()

Other impact_functions: index_g(), index_h(), index_lp(), index_maxprod(), index_rp(), index_w()


Discretized Pareto Type-II (Lomax) Distribution [TO DO]

Description

Probability mass function, cumulative distribution function, quantile function, and random generation for the Discretized Pareto Type-II distribution with shape parameter k>0k>0 and scale parameter s>0s>0.

[TO DO: rewrite in C, add NA handling, add working qdpareto2()]

Usage

rdpareto2(n, k = 1, s = 1)

pdpareto2(q, k = 1, s = 1, lower.tail = TRUE)

qdpareto2(p, k = 1, s = 1, lower.tail = TRUE)

ddpareto2(x, k = 1, s = 1)

Arguments

n

integer; number of observations

k

vector of shape parameters, k>0k>0

s

vector of scale parameters, s>0s>0

lower.tail

logical; if TRUE (default), probabilities are P(Xx)P(X \le x), and P(X>x)P(X > x) otherwise

p

vector of probabilities

x, q

vector of quantiles

Details

If XDP2(k,s)X\sim\mathrm{DP2}(k,s), then Y=X\lfloor Y\rfloor=X, where YY has ordinary Pareto Type-II distribution, see ppareto2.

Value

numeric vector; ddpareto2 gives the probability mass function, pdpareto2 gives the cumulative distribution function, qdpareto2 calculates the quantile function, and rdpareto2 generates random deviates.

See Also

Other distributions: rpareto2()

Other DiscretizedPareto2: dpareto2_estimate_mle()


Create an Adjacency Matrix Representing a Binary Relation

Description

Returns a binary relation that represents results of comparisons with pord of all pairs of elements in x. We have ret[i,j] == pord(x[[i]], x[[j]], ...).

Usage

rel_graph(x, pord, ...)

Arguments

x

list with elements to compare, preferably named

pord

a function with two arguments, returning a single Boolean value, e.g., pord_spread, pord_nd, or pord_weakdom

...

additional arguments passed to pord

Value

Returns a square logical matrix. dimnames of the matrix correspond to names of x.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Antisymmetric Binary Relations

Description

A binary relation RR is antisymmetric, iff for all x,yx, y we have xRyxRy and yRxyRx \Rightarrow x=yx=y.

Usage

rel_is_antisymmetric(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

rel_is_antisymmetric finds out if a given binary relation is antisymmetric. Missing values in R may result in NA.

Also, check out rel_closure_symmetric for the symmetric closure of R.

Value

rel_is_antisymmetric returns a single logical value.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Asymetric Binary Relations

Description

A binary relation RR is asymmetric, iff for all x,yx, y we have xRyxRy \Rightarrow ¬yRx\neg yRx.

Usage

rel_is_asymmetric(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

Note that an asymmetric relation is necessarily irreflexive, compare rel_is_irreflexive.

rel_is_asymmetric finds out if a given binary relation is asymmetric. Missing values in R may result in NA.

Also, check out rel_closure_symmetric for the symmetric closure of R.

Value

rel_is_asymmetric returns a single logical value.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Cyclic Binary Relations

Description

A binary relation RR is cyclic, iff its transitive closure is not antisymmetric. Note that RR may be reflexive and still acyclic, i.e., loops in RR are not taken into account.

Usage

rel_is_cyclic(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

rel_is_cyclic has O(n3)O(n^3) time complexity, where nn is the number of rows in R (the implemented algorithm currently verifies whether a depth-first search-based topological sorting is possible). Missing values in R always result in NA.

Value

rel_is_cyclic returns a single logical value.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Irreflexive Binary Relations

Description

A binary relation RR is irreflexive (or antireflexive), iff for all xx we have ¬xRx\neg xRx.

Usage

rel_is_irreflexive(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

rel_is_irreflexive finds out if a given binary relation is irreflexive. The function just checks whether all elements on the diagonal of R are zeros, i.e., it has O(n)O(n) time complexity, where nn is the number of rows in R. Missing values on the diagonal may result in NA.

When dealing with a graph's loops, i.e., elements related to themselves, you may be interested in finding a reflexive closure, see rel_closure_reflexive, or a reflexive reduction, see rel_reduction_reflexive.

Value

rel_is_irreflexive returns a single logical value.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Reflexive Binary Relations

Description

A binary relation RR is reflexive, iff for all xx we have xRxxRx.

Usage

rel_is_reflexive(R)

rel_closure_reflexive(R)

rel_reduction_reflexive(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

rel_is_reflexive finds out if a given binary relation is reflexive. The function just checks whether all elements on the diagonal of R are non-zeros, i.e., it has O(n)O(n) time complexity, where nn is the number of rows in R. Missing values on the diagonal may result in NA.

A reflexive closure of a binary relation RR, determined by rel_closure_reflexive, is the minimal reflexive superset RR' of RR.

A reflexive reduction of a binary relation RR, determined by rel_reduction_reflexive, is the minimal subset RR' of RR, such that the reflexive closures of RR and RR' are equal i.e., the largest irreflexive relation contained in RR.

Value

The rel_closure_reflexive and rel_reduction_reflexive functions return a logical square matrix. dimnames of R are preserved.

On the other hand, rel_is_reflexive returns a single logical value.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Symmetric Binary Relations

Description

A binary relation RR is symmetric, iff for all x,yx, y we have xRyxRy \Rightarrow yRxyRx.

Usage

rel_is_symmetric(R)

rel_closure_symmetric(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

rel_is_symmetric finds out if a given binary relation is symmetric. Any missing value behind the diagonal results in NA.

The symmetric closure of a binary relation RR, determined by rel_closure_symmetric, is the smallest symmetric binary relation that contains RR. Here, any missing values in R result in an error.

Value

The rel_closure_symmetric function returns a logical square matrix. dimnames of R are preserved.

On the other hand, rel_is_symmetric returns a single logical value.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_total(), rel_is_transitive(), rel_reduction_hasse()


Total Binary Relations

Description

A binary relation RR is total (or strong complete), iff for all xx, yy we have xRyxRy or yRxyRx.

Usage

rel_is_total(R)

rel_closure_total_fair(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

Note that each total relation is also reflexive, see rel_is_reflexive.

rel_is_total determines if a given binary relation R is total. The algorithm has O(n2)O(n^2) time complexity, where nn is the number of rows in R. If R[i,j] and R[j,i] is NA for some (i,j)(i,j), then the functions outputs NA.

The problem of finding a total closure or reduction is not well-defined in general.

When dealing with preorders, however, the following closure may be useful, see (Gagolewski, 2013). Fair totalization of RR, performed by rel_closure_total_fair, is the minimal superset RR' of RR such that if not xRyxRy and not yRxyRx then xRyxR'y and yRxyR'x.

Even if R is transitive, the resulting relation might not necessarily fulfil this property. If you want a total preorder, call rel_closure_transitive afterwards. Missing values in R are not allowed and result in an error.

Value

rel_is_total returns a single logical value.

rel_closure_reflexive returns a logical square matrix. dimnames of R are preserved.

References

Gagolewski M., Scientific Impact Assessment Cannot be Fair, Journal of Informetrics 7(4), 2013, pp. 792-802.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_transitive(), rel_reduction_hasse()


Transitive Binary Relations

Description

A binary relation RR is transitive, iff for all xx, yy, zz we have xRyxRy and yRzyRz \Longrightarrow xRzxRz.

Usage

rel_is_transitive(R)

rel_closure_transitive(R)

rel_reduction_transitive(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

rel_is_transitive finds out if a given binary relation is transitive. The algorithm has O(n3)O(n^3) time complexity, pessimistically, where nn is the number of rows in R. If R contains missing values behind the diagonal, the result will be NA.

The transitive closure of a binary relation RR, determined by rel_closure_transitive, is the minimal superset of RR such that it is transitive. Here we use the well-known Warshall algorithm (1962), which runs in O(n3)O(n^3) time.

The transitive reduction, see (Aho et al. 1972), of an acyclic binary relation RR, determined by rel_reduction_transitive, is a minimal unique subset RR' of RR, such that the transitive closures of RR and RR' are equal. The implemented algorithm runs in O(n3)O(n^3) time. Note that a transitive reduction of a reflexive relation is also reflexive. Moreover, some kind of transitive reduction (not necessarily minimal) is also determined in rel_reduction_hasse – it is useful for drawing Hasse diagrams.

Value

The rel_closure_transitive and rel_reduction_transitive functions return a logical square matrix. dimnames of R are preserved.

On the other hand, rel_is_transitive returns a single logical value.

References

Aho A.V., Garey M.R., Ullman J.D., The Transitive Reduction of a Directed Graph, SIAM Journal on Computing 1(2), 1972, pp. 131-137.

Warshall S., A theorem on Boolean matrices, Journal of the ACM 9(1), 1962, pp. 11-12.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_reduction_hasse()


Hasse Diagrams

Description

This function computes the reflexive reduction and a kind of transitive reduction which is useful for drawing Hasse diagrams.

Usage

rel_reduction_hasse(R)

Arguments

R

an object coercible to a 0-1 (logical) square matrix, representing a binary relation on a finite set.

Details

The input matrix RR might not necessarily be acyclic/asymmetric, i.e., it may represent any totally preordered set (which induces an equivalence relation on the underlying preordered set). The implemented algorithm runs in O(n3)O(n^3) time and first determines the transitive closure of RR. If an irreflexive RR is given, then the transitive closures of RR and of the resulting matrix are identical. Moreover, if RR is additionally acyclic, then this function is equivalent to rel_reduction_transitive.

Value

The rel_reduction_hasse function returns a logical square matrix. dimnames of R are preserved.

See Also

Other binary_relations: check_comonotonicity(), pord_nd(), pord_spread(), pord_weakdom(), rel_graph(), rel_is_antisymmetric(), rel_is_asymmetric(), rel_is_cyclic(), rel_is_irreflexive(), rel_is_reflexive(), rel_is_symmetric(), rel_is_total(), rel_is_transitive()

Examples

## Not run: 
# Let ord be a total preorder (a total and transitive binary relation)
# === Plot the Hasse diagram of ord ===
# ===  requires the igraph package  ===
library("igraph")
hasse <- graph.adjacency(rel_reduction_transitive(ord))
plot(hasse, layout=layout.fruchterman.reingold(hasse, dim=2))

## End(Not run)

Pareto Type-II (Lomax) Distribution

Description

Density, cumulative distribution function, quantile function, and random generation for the Pareto Type-II (Lomax) distribution with shape parameter k>0k>0 and scale parameter s>0s>0.

[TO DO: rewrite in C, add NA handling]

Usage

rpareto2(n, k = 1, s = 1)

ppareto2(q, k = 1, s = 1, lower.tail = TRUE)

qpareto2(p, k = 1, s = 1, lower.tail = TRUE)

dpareto2(x, k = 1, s = 1)

Arguments

n

integer; number of observations

k

vector of shape parameters, k>0k>0

s

vector of scale parameters, s>0s>0

lower.tail

logical; if TRUE (default), probabilities are P(Xx)P(X \le x), and P(X>x)P(X > x) otherwise

p

vector of probabilities

x, q

vector of quantiles

Details

If XP2(k,s)X\sim\mathrm{P2}(k,s), then suppX=[0,)\mathrm{supp}\,X=[0,\infty). The c.d.f. for x0x\ge 0 is given by

F(x)=1sk/(s+x)kF(x)=1-s^k/(s+x)^k

and the density by

f(x)=ksk/(s+x)k+1.f(x)=k s^k/(s+x)^{k+1}.

Value

numeric vector; dpareto2 gives the density, ppareto2 gives the cumulative distribution function, qpareto2 calculates the quantile function, and rpareto2 generates random deviates.

See Also

Other distributions: rdpareto2()

Other Pareto2: pareto2_estimate_mle(), pareto2_estimate_mmse(), pareto2_test_ad(), pareto2_test_f()


t-conorms

Description

Various t-conorms. Each of these is a fuzzy logic generalization of the classical alternative operation.

Usage

tconorm_minimum(x, y)

tconorm_product(x, y)

tconorm_lukasiewicz(x, y)

tconorm_drastic(x, y)

tconorm_fodor(x, y)

Arguments

x

numeric vector with elements in [0,1][0,1]

y

numeric vector of the same length as x, with elements in [0,1][0,1]

Details

A function S:[0,1]×[0,1][0,1]S: [0,1]\times [0,1]\to [0,1] is a t-conorm if for all x,y,z[0,1]x,y,z\in [0,1] it holds: (a) S(x,y)=S(y,x)S(x,y)=S(y,x); (b) if yzy\le z, then S(x,y)S(x,z)S(x,y)\le S(x,z); (c) S(x,S(y,z))=S(S(x,y),z)S(x,S(y,z))=S(S(x,y),z); (d) S(x,0)=xS(x, 0)=x.

The minimum t-conorm is given by SM(x,y)=max(x,y)S_M(x,y)=max(x, y).

The product t-conorm is given by SP(x,y)=x+yxyS_P(x,y)=x+y-xy.

The Lukasiewicz t-conorm is given by SL(x,y)=min(x+y,1)S_L(x,y)=min(x+y,1).

The drastic t-conorm is given by SD(x,y)=1S_D(x,y)=1 iff x,y(0,1]x,y\in (0,1], and max(x,y)max(x, y) otherwise.

The Fodor t-conorm is given by SF(x,y)=1S_F(x,y)=1 iff x+y1x+y \ge 1, and max(x,y)max(x, y) otherwise.

Value

Numeric vector of the same length as x and y. The ith element of the resulting vector gives the result of calculating S(x[i], y[i]).

References

Klir G.J, Yuan B., Fuzzy sets and fuzzy logic. Theory and applications, Prentice Hall PTR, New Jersey, 1995.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other fuzzy_logic: fimplication_minimal(), fnegation_yager(), tnorm_minimum()


t-norms

Description

Various t-norms. Each of these is a fuzzy logic generalization of the classical conjunction operation.

Usage

tnorm_minimum(x, y)

tnorm_product(x, y)

tnorm_lukasiewicz(x, y)

tnorm_drastic(x, y)

tnorm_fodor(x, y)

Arguments

x

numeric vector with elements in [0,1][0,1]

y

numeric vector of the same length as x, with elements in [0,1][0,1]

Details

A function T:[0,1]×[0,1][0,1]T: [0,1]\times [0,1]\to [0,1] is a t-norm if for all x,y,z[0,1]x,y,z\in [0,1] it holds: (a) T(x,y)=T(y,x)T(x,y)=T(y,x); (b) if yzy\le z, then T(x,y)T(x,z)T(x,y)\le T(x,z); (c) T(x,T(y,z))=T(T(x,y),z)T(x,T(y,z))=T(T(x,y),z); (d) T(x,1)=xT(x, 1)=x.

The minimum t-norm is given by TM(x,y)=min(x,y)T_M(x,y)=min(x, y).

The product t-norm is given by TP(x,y)=xyT_P(x,y)=xy.

The Lukasiewicz t-norm is given by TL(x,y)=max(x+y1,0)T_L(x,y)=max(x+y-1,0).

The drastic t-norm is given by TD(x,y)=0T_D(x,y)=0 iff x,y[0,1)x,y\in [0,1), and min(x,y)min(x, y) otherwise.

The Fodor t-norm is given by TF(x,y)=0T_F(x,y)=0 iff x+y1x+y \le 1, and min(x,y)min(x, y) otherwise.

Value

Numeric vector of the same length as x and y. The ith element of the resulting vector gives the result of calculating T(x[i], y[i]).

References

Klir G.J, Yuan B., Fuzzy sets and fuzzy logic. Theory and applications, Prentice Hall PTR, New Jersey, 1995.

Gagolewski M., Data Fusion: Theory, Methods, and Applications, Institute of Computer Science, Polish Academy of Sciences, 2015, 290 pp. isbn:978-83-63159-20-7

See Also

Other fuzzy_logic: fimplication_minimal(), fnegation_yager(), tconorm_minimum()