Package 'FuzzySimRes'

Title: Simulation and Resampling Methods for Epistemic Fuzzy Data
Description: Random simulations of fuzzy numbers are still a challenging problem. The aim of this package is to provide the respective procedures to simulate fuzzy random variables, especially in the case of the piecewise linear fuzzy numbers (PLFNs, see Coroianua et al. (2013) <doi:10.1016/j.fss.2013.02.005> for the further details). Additionally, the special resampling algorithms known as the epistemic bootstrap are provided (see Grzegorzewski and Romaniuk (2022) <doi:10.34768/amcs-2022-0021>, Grzegorzewski and Romaniuk (2022) <doi:10.1007/978-3-031-08974-9_39>) together with the functions to apply statistical tests and estimate various characteristics based on the epistemic bootstrap. The package also includes a real-life data set of epistemic fuzzy triangular numbers. The fuzzy numbers used in this package are consistent with the 'FuzzyNumbers' package.
Authors: Maciej Romaniuk [cre, aut] , Przemyslaw Grzegorzewski [aut] , Abbas Parchami [aut] , Luis Carvalho [ctb, cph] (Procedures from kolmim package in the kolmim.c file)
Maintainer: Maciej Romaniuk <[email protected]>
License: GPL-3
Version: 0.4.3
Built: 2024-11-26 06:41:38 UTC
Source: CRAN

Help Index


Generate a bootstrap sample with the epistemic antithetic bootstrap.

Description

'AntitheticBootstrap' generates the secondary (real-valued) sample from the fuzzy-valued initial sample using the epistemic antithetic bootstrap.

Usage

AntitheticBootstrap(fuzzySample, cutsNumber = 1, ...)

Arguments

fuzzySample

Sample of fuzzy numbers given in the form of a list or as a single number.

cutsNumber

Number of cuts used in the antithetic epistemic bootstrap.

...

Possible parameters passed to other functions.

Details

The procedure randomly generates the secondary, bootstrapped sample of real values from the initial sample which consists of fuzzy numbers. The procedure applies the special version of the epistemic bootstrap, known as the antithetic bootstrap. The initial sample should be given in the form of a list of numbers or a single number. These values have to be the fuzzy numbers defined in the FuzzyNumbers package.

Value

The output is given in the form of the real-valued matrix, where the number of rows is equal to the number of cuts, and the number of columns is equal to the length of the initial sample. Rows are denoted with the randomly drawn values of alpha for the consecutive alpha-cuts.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

EpistemicBootstrap for the standard epistemic bootstrap algorithm

Other epistemic bootstrap function: EpistemicBootstrap()

Examples

# seed PRNG

set.seed(1234)

# generate the initial sample consisting of 5 trapezoidal fuzzy numbers

sample1 <- SimulateSample(5,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# apply the antithetic bootstrap with 10 cuts

AntitheticBootstrap (sample1$value, cutsNumber=10)

Apply averaging statistics epistemic test for one or two fuzzy samples.

Description

'AverageStatisticEpistemicTest' calculates the p-value for the given real-valued statistical test using the averaging statistics epistemic bootstrap approach.

Usage

AverageStatisticEpistemicTest(
  sample1,
  sample2,
  bootstrapMethod = "std",
  test = "ks.test",
  cutsNumber = 1,
  criticalValueFunction = "KSTestCriticalValue",
  ...
)

Arguments

sample1

Sample of fuzzy numbers given in the form of a list or as a single number.

sample2

Sample of fuzzy numbers given in the form of a list or as a single number (two-sample test case) or NULL (one-sample test case).

bootstrapMethod

The standard (std) or antithetic (anti) method used for the epistemic bootstrap.

test

Name of the invoked function for the statistical test.

cutsNumber

Number of cuts used in the epistemic bootstrap.

criticalValueFunction

Name of the function that converts the test statistic into the p-value.

...

Additional arguments passed to the statistical test.

Details

The procedure calculates the p-value for the selected real-valued statistical test, like, e.g. the Kolmogorov-Smirnov one- or two-sample test (invoked by ks.test function). Another statistical test can be also used if it has at least one or two parameters (x for one or x,y for two real-valued samples, namely) and gives a list of at least two values (statistic for the output test statistic, and p.value for the calculated p-value). If necessary, the respective wrapper can be applied for the user-defined function. To choose the one-sample variant of the test, sample2=NULL should be used. Additional parameters to the statistical test can be passed with ...

As two input samples (sample1 and sample2, respectively), two lists of fuzzy numbers should be provided. These values have to be the fuzzy numbers defined in the FuzzyNumbers package (triangular, trapezoidal, etc.). If only one-sample test is used, sample1 is related to the fuzzy statistical sample, and sample2=NULL should be set.

Additionally, the function that calculates the p-value for the given critical level (i.e. value of the test statistic) should be provided using the parameter criticalValueFunction. This function is invoked with tree parameters: criticalValue - the critical value, n1 - tge size of the first initial sample, n2 - the size of the second initial sample (if necessary, otherwise n2=NA). For convenience, its variant for the Kolmogorov-Smirnov two-sample test is provided (the function KSTestCriticalValue).

To calculate the output, the averaging statistics epistemic bootstrap approach is used. Depending on the parameter bootstrapMethod, the standard (std) or antithetic (anti) method can be used. Then, the obtained test statistics are averaged to give the respective p-value and final result.

Value

The output is given in the form of a real number (the p-value) for the selected statistical test.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

MultiStatisticEpistemicTest for the epistemic bootstrap test related to multi-statistic approach, ResamplingStatisticEpistemicTest for the epistemic bootstrap test related to resampling statistics, EpistemicTest for the general epistemic bootstrap test

Other epistemic bootstrap statistical test: EpistemicTest(), MultiStatisticEpistemicTest(), ResamplingStatisticEpistemicTest()

Examples

# seed PRNG

set.seed(1234)

# generate two independent initial fuzzy samples

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")


list2<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# apply the Kolmogorov-Smirnov two sample test for two different samples

AverageStatisticEpistemicTest(list1$value,list2$value,cutsNumber = 30)

# and the same sample twice

AverageStatisticEpistemicTest(list1$value,list1$value,cutsNumber = 30,bootstrapMethod = "anti")

Combine several p-values to obtain a single value.

Description

'CombinePValues' calculates the single combined p-value using several input p-values.

Usage

CombinePValues(pValues, method = "simes", ...)

Arguments

pValues

A vector of the p-values.

method

Method used to combine the p-values. The possible methods are the same as in the palasso package plus the mean approach.

...

Possible parameters passed to other functions.

Details

The procedure combines many p-values into a single output using the selected statistical method. This function is used as a tool in one of the epistemic bootstrap approaches to provide the necessary final p-value in the statistical test. To combine the p-values different statistical methods can be applied. Apart from the mean method (i.e., simple average of all p-values), other methods are derived from the palasso package (the function .combine is used there).

Value

The output is given as a single real-valued number.

References

Westfall, P. H. (2005). Combining p-values. Encyclopedia of Biostatistics, doi: 10.1002/0470011815.b2a15181 <https://doi.org/10.1002/0470011815.b2a15181>

Examples

# combine the p-values using the Simes method

p <- runif(20)

CombinePValues(p)

Fuzzy control charts data

Description

A set of fuzzy epistemic data concerning electronic circuit thickness, which is one of the most important quality characteristics in a process that produces electronic boards for vacuum cleaners.

Usage

controlChartData

Format

A list of 90 triangular fuzzy numbers (as defined in FuzzyNumbers package) that contains 30 samples, each of size three. Each observation in the list has its label X.y.z, where y is the number of sample, and z is the number of the element in this sample.

Source

Faraz, A., Shapiro, A.F. (2010) An application of fuzzy random variables to control charts. Fuzzy Sets and Systems, 161(20) <https://doi.org/10.1016/j.fss.2010.05.004>


Generate a bootstrap sample with the epistemic bootstrap.

Description

'EpistemicBootstrap' generates the secondary (real-valued) sample from the fuzzy-valued initial sample using the epistemic bootstrap.

Usage

EpistemicBootstrap(fuzzySample, cutsNumber = 1, ...)

Arguments

fuzzySample

Sample of fuzzy numbers given in the form of a list or as a single number.

cutsNumber

Number of cuts used in the epistemic bootstrap.

...

Possible parameters passed to other functions.

Details

The procedure randomly generates the secondary, bootstrapped sample of real values from the initial sample which consists of fuzzy numbers. The procedure applies the so-called epistemic bootstrap. The initial sample should be given in the form of a list of numbers or a single number. These values have to be the fuzzy numbers defined in the FuzzyNumbers package.

Value

The output is given in the form of a real-valued matrix, where the number of rows is equal to the number of cuts, and the number of columns is equal to the length of the initial sample. Rows are denoted with the randomly drawn values of alpha for the consecutive alpha-cuts.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

AntitheticBootstrap for the antithetic epistemic bootstrap algorithm

Other epistemic bootstrap function: AntitheticBootstrap()

Examples

# seed PRNG

set.seed(1234)

# generate the initial sample consisting of 5 trapezoidal fuzzy numbers

sample1 <- SimulateSample(5,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# apply the epistemic bootstrap with 10 cuts

EpistemicBootstrap (sample1$value, cutsNumber=10)

Calculate the corrected variance using the epistemic bootstrap.

Description

'EpistemicCorrectedVariance' calculates the corrected estimator of the variance for the fuzzy sample using the epistemic bootstrap approach.

Usage

EpistemicCorrectedVariance(
  fuzzySample,
  cutsNumber = 1,
  bootstrapMethod = "std",
  ...
)

Arguments

fuzzySample

Sample of fuzzy numbers (given in the form of a list or as a single number) or a matrix with already sampled values (i.e. output of function AntitheticBootstrap or EpistemicBootstrap).

cutsNumber

Number of cuts used in the epistemic bootstrap.

bootstrapMethod

The standard (std) or antithetic (anti) method used for the epistemic bootstrap.

...

Possible parameters passed to other functions.

Details

For the initial sample given by fuzzySample, the function calculates the corrected estimator of the variance using the standard (if bootstrapMethod is set to "std") or the antithetic (when bootstrapMethod="anti") epistemic bootstrap. The initial sample should be given in the form of a list of numbers or a single number. These values have to be the fuzzy numbers defined in the FuzzyNumbers package. The corrected estimator of the variance separates the within- and between-group variations. For the details, see (Grzegorzewski, Romaniuk, 2022a).

If, instead of fuzzy sample, the matrix is given by the parameter fuzzySample, then this matrix is treated as the direct output from the epistemic or the antithetic bootstrap. Then, the corrected estimator of the variance is directly calculated.

Value

The output is given in the form of a real number (the estimator of the variance).

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

EpistemicMean for the epistemic estimator of the mean, EpistemicEstimator for the general function concerning the epistemic estimator calculation

Other epistemic estimators: EpistemicMean()

Examples

# seed PRNG

set.seed(1234)

# generate an initial fuzzy sample

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")



# calculate the corrected variance using the standard epistemic bootstrap approach

EpistemicCorrectedVariance(list1$value,cutsNumber = 30)

# calculate the corrected variance using the antithetic epistemic bootstrap approach

EpistemicCorrectedVariance(list1$value,cutsNumber = 30,bootstrapMethod="anti")

# use the epistemic bootstrap

list1Epistemic<-EpistemicBootstrap(list1$value,cutsNumber = 10)

# calculate the standard deviation using the obtained output

EpistemicCorrectedVariance(list1Epistemic)

Apply the epistemic bootstrap to find an estimator.

Description

'EpistemicEstimator' calculates the selected estimator and its SE/MSE for the fuzzy sample using the epistemic bootstrap approach.

Usage

EpistemicEstimator(
  fuzzySample,
  estimator = "sd",
  cutsNumber = 1,
  bootstrapMethod = "std",
  trueValue = NA,
  ...
)

Arguments

fuzzySample

Sample of fuzzy numbers (given in the form of a list or as a single number) or a matrix with already sampled values (i.e. output of function AntitheticBootstrap or EpistemicBootstrap).

estimator

Real-valued function used to calculate the respective estimator.

cutsNumber

Number of cuts used in the epistemic bootstrap.

bootstrapMethod

The standard (std) or antithetic (anti) method used for the epistemic bootstrap.

trueValue

The true (usually unknown) value of the estimated parameter. If value other than NA is used, then the MSE is calculated.

...

Possible parameters passed to other functions.

Details

For the initial sample given by fuzzySample, the function calculates the selected estimator (provided by the respective function as the estimator parameter) using the standard (if bootstrapMethod is set to "std") or the antithetic (when bootstrapMethod="anti") epistemic bootstrap. The initial sample should be given in the form of a list of numbers or a single number. These values have to be the fuzzy numbers defined as in the FuzzyNumbers package. The estimators are calculated for each epistemic bootstrap sample (i.e. based on the rows of the output matrix), then these values are averaged to give the final output (i.e. the mean for all cuts is obtained).

If, instead of fuzzy sample, the matrix is given by the parameter fuzzySample, then this matrix is treated as the direct output from the epistemic or the antithetic bootstrap. Then, the respective estimator is directly calculated.

Additionally, the standard error (SE) of this estimator is calculated and its mean squared error (MSE). This second type of the error is used if some value (other than NA) is provided for the trueValue parameter.

Value

The output is given in the form of a list consisting of real numbers: value - the obtained estimator, SE - its SE, and MSE - its MSE.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

EpistemicMean for the epistemic estimator of the mean, EpistemicCorrectedVariance for the corrected epistemic estimator of the variance

Examples

# seed PRNG

set.seed(1234)

# generate an initial fuzzy sample

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")



# calculate the standard deviation using the standard epistemic bootstrap approach

EpistemicEstimator(list1$value,estimator="sd",cutsNumber = 30)

# calculate the median using the antithetic epistemic bootstrap approach

EpistemicEstimator(list1$value,estimator="median",cutsNumber = 30,bootstrapMethod="anti")

# use the epistemic bootstrap

list1Epistemic<-EpistemicBootstrap(list1$value,cutsNumber = 10)

# calculate the standard deviation using the obtained output

EpistemicEstimator(list1Epistemic,estimator="sd")

Estimate the mean using the epistemic bootstrap.

Description

'EpistemicMean' calculates the mean of the fuzzy sample using the epistemic bootstrap approach.

Usage

EpistemicMean(
  fuzzySample,
  cutsNumber = 1,
  bootstrapMethod = "std",
  trueValue = NA
)

Arguments

fuzzySample

Sample of fuzzy numbers (given in the form of a list or as a single number) or a matrix with already sampled values (i.e. output of function AntitheticBootstrap or EpistemicBootstrap).

cutsNumber

Number of cuts used in the epistemic bootstrap.

bootstrapMethod

The standard (std) or antithetic (anti) method used for the epistemic bootstrap.

trueValue

The true (usually unknown) value of the estimated parameter. If NA is used for this parameter, the SE is calculated.

Details

For the initial sample given by fuzzySample, the function estimates its mean using the standard (if bootstrapMethod is set to "std") or the antithetic (when bootstrapMethod="anti") epistemic bootstrap. The initial sample should be given in the form of a list of numbers or a single number. These values have to be the fuzzy numbers defined in the FuzzyNumbers package.

If, instead of fuzzy sample, the matrix is given by the parameter fuzzySample, then this matrix is treated as the direct output from the epistemic or the antithetic bootstrap. Then, the mean is directly calculated.

Additionally, the standard error (SE) of this estimator is calculated and its mean squared error (MSE). This second type of the error is used if some value (other than NA) is provided for the trueValue parameter.

Value

The output is given in the form of a real number (the estimator of the mean).

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

EpistemicEstimator for the general function concerning the epistemic estimator calculation, EpistemicCorrectedVariance for the corrected epistemic estimator of the variance

Other epistemic estimators: EpistemicCorrectedVariance()

Examples

# seed PRNG

set.seed(1234)

# generate an initial fuzzy sample

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")



# calculate the mean using the standard epistemic bootstrap approach

EpistemicMean(list1$value,cutsNumber = 30)

# calculate the mean using the antithetic epistemic bootstrap approach

EpistemicMean(list1$value,cutsNumber = 30,bootstrapMethod="anti")

Apply epistemic test for one or two fuzzy samples.

Description

'EpistemicTest' calculates the p-value for the given real-valued statistical test using one of the epistemic bootstrap approaches.

Usage

EpistemicTest(sample1, sample2, algorithm = "avs", ...)

Arguments

sample1

Sample of fuzzy numbers given in the form of a list or as a single number.

sample2

Sample of fuzzy numbers given in the form of a list or as a single number (two-sample test case) or NULL (one-sample test case).

algorithm

Type of the epistemic bootstrap algorithm used to calculate the output p-value (possible values: avs, ms, res).

...

Additional arguments passed to the epistemic test.

Details

This is a general procedure that can be used to invoke other epistemic bootstrap tests: AverageStatisticEpistemicTest (if the algorithm is set to "avs"), MultiStatisticEpistemicTest (if algorithm="ms"), and ResamplingStatisticEpistemicTest (for algorithm="res"). For additional details about these procedures and their parameters, see the respective functions.

Value

The output is given in the form of a real number (the p-value) for the selected statistical test.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

MultiStatisticEpistemicTest for the epistemic bootstrap test related to multi-statistic approach, ResamplingStatisticEpistemicTest for the epistemic bootstrap test related to resampling statistics, AverageStatisticEpistemicTest for the epistemic bootstrap test related to averaging statistics,

Other epistemic bootstrap statistical test: AverageStatisticEpistemicTest(), MultiStatisticEpistemicTest(), ResamplingStatisticEpistemicTest()

Examples

# seed PRNG

set.seed(1234)

# generate two independent initial fuzzy samples

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")


list2<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# apply the Kolmogorov-Smirnov two sample test for two different samples
# with the average statistics approach

EpistemicTest(list1$value,list2$value,cutsNumber = 30)

# apply the Kolmogorov-Smirnov two sample test for two different samples
# with the multi-statistic and antithetic approach

EpistemicTest(list1$value,list2$value,algorithm = "ms",bootstrapMethod = "anti")

A simple wrapper to provide the p-value for the K-S one- and two-sample test.

Description

'KSTestCriticalValue' calculates the p-value for the given critical value, based on the respective function from the stats package.

Usage

KSTestCriticalValue(criticalValue, n1, n2)

Arguments

criticalValue

Critical value for the one- or two-sample K-S test.

n1

Size of the first sample.

n2

Size of the second sample (or NA for the case of the one-sample test).

Details

The function calculates the p-value for the one- and two-sample Kolmogorov-Smirnov test using the respective function from the stats package. The necessary information is the critical value given by criticalValue parameter, and the sizes of one or two samples (parameters n1, n2, respectively). The output is used in one of the epistemic bootstrap methods if the one- or two-sample K-S test is applied.

Value

The output is given as a real number equal to the p-value for the one- or two-sample K-S test.

Examples

# find p-value for the critical value 0.3 and two samples of size 10

KSTestCriticalValue(0.3,10,10)

Apply multi-statistic epistemic test for one or two fuzzy samples.

Description

'MultiStatisticEpistemicTest' calculates the p-value for the given real-valued statistical test using the multi-statistic epistemic bootstrap approach.

Usage

MultiStatisticEpistemicTest(
  sample1,
  sample2,
  bootstrapMethod = "std",
  test = "ks.test",
  cutsNumber = 1,
  combineMethod = "simes",
  ...
)

Arguments

sample1

Sample of fuzzy numbers given in the form of a list or as a single number.

sample2

Sample of fuzzy numbers given in the form of a list or as a single number (two-sample test case) or NULL (one-sample test case).

bootstrapMethod

The standard (std) or antithetic (anti) method used for the epistemic bootstrap.

test

Name of the invoked function for the statistical test.

cutsNumber

Number of cuts used in the epistemic bootstrap.

combineMethod

Name of the method used to combine the multiple p-values to provide the single output.

...

Additional arguments passed to the statistical test.

Details

The procedure calculates the p-value for the selected real-valued statistical test, like, e.g. the Kolmogorov-Smirnov one- or two-sample test (invoked by ks.test function). Another statistical test can be also used if it has at least one or two parameters (x for one or x,y for two real-valued samples, namely) and gives a list of at least two values (statistic for the output test statistic, and p.value for the calculated p-value). If necessary, the respective wrapper can be applied for the user-defined function. To choose the one-sample variant of the test, sample2=NULL should be used. Additional parameters to the statistical test can be passed with ...

As two input samples (sample1 and sample2, respectively), two lists of fuzzy numbers should be provided. These values have to be the fuzzy numbers defined in the FuzzyNumbers package (triangular, trapezoidal, etc.). If only one-sample test is used, sample1 is related to the fuzzy statistical sample, and sample2=NULL should be set.

To calculate the output, the multi-statistic epistemic bootstrap approach is used. Depending on the parameter bootstrapMethod, the standard (std) or antithetic (anti) method can be used. Then, the p-values are combined using the respective method (a value of the parameter combineMethod, which is the same as for the function CombinePValues) to give a single result.

Value

The output is given in the form of a real number (the p-value) for the selected statistical test.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

AverageStatisticEpistemicTest for the epistemic bootstrap test related to averaging statistics, ResamplingStatisticEpistemicTest for the epistemic bootstrap test related to resampling statistics EpistemicTest for the general epistemic bootstrap test

Other epistemic bootstrap statistical test: AverageStatisticEpistemicTest(), EpistemicTest(), ResamplingStatisticEpistemicTest()

Examples

# seed PRNG

set.seed(1234)

# generate two independent initial fuzzy samples

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")


list2<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# apply the Kolmogorov-Smirnov two sample test for two different samples

MultiStatisticEpistemicTest(list1$value,list2$value,cutsNumber = 30)

# and the same sample twice

MultiStatisticEpistemicTest(list1$value,list1$value,cutsNumber = 30,bootstrapMethod = "anti",
combineMethod = "mean")

# and the one-sample K-S test for the standard normal distribution

MultiStatisticEpistemicTest(list1$value,sample2=NULL,cutsNumber = 30,y="pnorm")

Apply resampling epistemic test for one or two fuzzy samples.

Description

'ResamplingStatisticEpistemicTest' calculates the p-value for the given real-valued statistical test using the resampling epistemic bootstrap approach.

Usage

ResamplingStatisticEpistemicTest(
  sample1,
  sample2,
  bootstrapMethod = "std",
  test = "ks.test",
  cutsNumber = 1,
  K = 1,
  combineMethod = "simes",
  ...
)

Arguments

sample1

Sample of fuzzy numbers given in the form of a list or as a single number.

sample2

Sample of fuzzy numbers given in the form of a list or as a single number (two-sample test case) or NULL (one-sample test case).

bootstrapMethod

The standard (std) or antithetic (anti) method used for the epistemic bootstrap.

test

Name of the invoked function for the statistical test.

cutsNumber

Number of cuts used in the epistemic bootstrap.

K

Number of samples used to resample in the calculation of the p-values.

combineMethod

Name of the method used to combine the multiple p-values to provide the single output.

...

Additional arguments passed to the statistical test.

Details

The procedure calculates the p-value for the selected real-valued statistical test, like, e.g. the Kolmogorov-Smirnov one- or two-sample test (invoked by ks.test function). Another statistical test can be also used if it has at least one or two parameters (x for one or x,y for two real-valued samples, namely) and gives a list of at least two values (statistic for the output test statistic, and p.value for the calculated p-value). If necessary, the respective wrapper can be applied for the user-defined function. To choose the one-sample variant of the test, sample2=NULL should be used. Additional parameters to the statistical test can be passed with ...

As two input samples (sample1 and sample2, respectively), two lists of fuzzy numbers should be provided. These values have to be the fuzzy numbers defined in the FuzzyNumbers package (triangular, trapezoidal, etc.). If only one-sample test is used, sample1 is related to the fuzzy statistical sample, and sample2=NULL should be set.

To calculate the output, the multi-statistic epistemic bootstrap approach is used. Depending on the parameter bootstrapMethod, the standard (std) or antithetic (anti) method can be used. Then, the p-values are combined using the respective method (a value of the parameter combineMethod, which is the same as for the function CombinePValues) to give a single result.

Value

The output is given in the form of a real number (the p-value) for the selected statistical test.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrapped Kolmogorov-Smirnov Test for Epistemic Fuzzy Data. Communications in Computer and Information Science, CCIS 1602, pp. 494-507, Springer

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

See Also

MultiStatisticEpistemicTest for the epistemic bootstrap test related to multi-statistic approach, AverageStatisticEpistemicTest for the epistemic bootstrap test related to averaging statistics, EpistemicTest for the general epistemic bootstrap test

Other epistemic bootstrap statistical test: AverageStatisticEpistemicTest(), EpistemicTest(), MultiStatisticEpistemicTest()

Examples

# seed PRNG

set.seed(1234)

# generate two independent initial fuzzy samples

list1<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")


list2<-SimulateSample(20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# apply the Kolmogorov-Smirnov two sample test for two different samples

ResamplingStatisticEpistemicTest(list1$value,list2$value,cutsNumber = 30)

# and the same sample twice

ResamplingStatisticEpistemicTest(list1$value,list1$value,cutsNumber = 30,bootstrapMethod = "anti")

Simulate random fuzzy number.

Description

'SimulateFuzzyNumber' generates a single fuzzy number using the various random distributions based on the functions from the stats package.

Usage

SimulateFuzzyNumber(
  originalPD,
  parOriginalPD,
  incrCorePD,
  parIncrCorePD,
  suppLeftPD,
  parSuppLeftPD,
  suppRightPD,
  parSuppRightPD,
  knotNumbers = 0,
  type = "trapezoidal",
  ...
)

Arguments

originalPD

Name of the random generator used to create the "true origin" of fuzzy number (as defined in the stats package).

parOriginalPD

List of parameters required by the random generator used to create the "true origin" of a fuzzy number.

incrCorePD

Name of the random generator used to create the increases of the core of fuzzy number (as defined in the stats package).

parIncrCorePD

List of parameters required by the random generator used to create the increases of the core of trapezoidal number.

suppLeftPD

Name of the random generator used to create the increase of the left support of fuzzy number (as defined in the stats package).

parSuppLeftPD

List of parameters required by the random generator used to create the increase of the left support of fuzzy number.

suppRightPD

Name of the random generator used to create the increase of the right support of fuzzy number (as defined in the stats package).

parSuppRightPD

List of parameters required by the random generator used to create the increase of the right support of trapezoidal number.

knotNumbers

Number of the knots necessary to generate the output fuzzy number.

type

Type of the generated fuzzy number ("triangular", "trapezoidal", or "PLFN").

...

Possible parameters passed to other functions.

Details

The procedure randomly generates a fuzzy number (a triangular, trapezoidal, or PLFN one) with the originalPD, increases of its core, and increases of its support given by some random distributions. The names of the respective functions of these probability distributions should be in the form required by the stats package. For triangular fuzzy number, increasesRandomDist is not used. For both triangular and trapezoidal fuzzy numbers, knotNumbers is not used.

The "true origin" of the fuzzy number is independently drawn from the probability distribution using originalPD function from the stats package with the list of parameters defined by parOriginalPD. The same applies to the increases of the core (the function incrCorePD with the parameters parIncrCorePD is then used), the left increase of the support (the function suppLeftPD with the parameters parSuppLeftPD, respectively), and the right increase of the support (the function suppRightPD with the parameters parSuppRightPD, respectively).

Value

The output is given as a list of two values: original with "true origin" of the simulated fuzzy number generated from the probability distribution originalPD, and value – the simulated triangular, trapezoidal, or PLFN fuzzy number as in the FuzzyNumbers package.

References

Ban, A.I., Coroianu, L., Grzegorzewski, P. (2015) Fuzzy Numbers: Approximations, Ranking and Applications. Institute of Computer Sciences, Polish Academy of Sciences

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap methods for fuzzy data. Uncertainty and Imprecision in Decision Making and Decision Support: New Advances, Challenges, and Perspectives, pp. 28-47 Springer

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

Parchami, A., Grzegorzewski, P., Romaniuk, M. (2024) Statistical simulations with LR random fuzzy numbers. Statistical Papers

See Also

SimulateSample for generation of the whole random fuzzy sample

Examples

# seed PRNG

set.seed(1234)

# generate triangular fuzzy number (the normal distribution for the "true origin",
# and two different uniform distribution for the increases of the support)

SimulateFuzzyNumber(originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="triangular")

# generate trapezoidal fuzzy number (the normal distribution for the "true origin",
# the exponential distribution for the increases of the core,
# and two different uniform distribution for the increases of the support)

SimulateFuzzyNumber(originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# generate PLFN fuzzy number with two knots

SimulateFuzzyNumber(originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
knotNumbers = 2,
type="PLFN")

Simulate a sample of random fuzzy numbers.

Description

'SimulateSample' generates the whole sample of fuzzy numbers using the various random distributions based on the functions from the stats package.

Usage

SimulateSample(
  n = 1,
  originalPD,
  parOriginalPD,
  incrCorePD,
  parIncrCorePD,
  suppLeftPD,
  parSuppLeftPD,
  suppRightPD,
  parSuppRightPD,
  knotNumbers = 0,
  type = "trapezoidal",
  ...
)

Arguments

n

Size of the simulated sample

originalPD

Name of the random generator used to create the "true origin" of a fuzzy number (as defined in the stats package).

parOriginalPD

List of parameters required by the random generator used to create the "true origin" of fuzzy number.

incrCorePD

Name of the random generator used to create the increases of the core of fuzzy number (as defined in the stats package).

parIncrCorePD

List of parameters required by the random generator used to create the increases of the core of trapezoidal number.

suppLeftPD

Name of the random generator used to create the increases of the left support of fuzzy number (as defined in the stats package).

parSuppLeftPD

List of parameters required by the random generator used to create the increases of the left support of fuzzy number.

suppRightPD

Name of the random generator used to create the increases of the right support of fuzzy number (as defined in the stats package).

parSuppRightPD

List of parameters required by the random generator used to create the increases of the right support of trapezoidal number.

knotNumbers

Number of the knots necessary to generate the output fuzzy number.

type

Type of the generated fuzzy number ("triangular", "trapezoidal", or "PLFN").

...

Possible parameters passed to other functions.

Details

The procedure randomly generates the independent sample of fuzzy numbers (triangulars, trapezoidals, or PLFNs) with the original, increases of its core, and increases of its support given by some random distributions. The names of the respective functions of these probability distributions should be in the form required by the stats package. For triangular fuzzy number, increasesRandomDist is not used. For both triangular and trapezoidal fuzzy numbers, knotNumbers is not used.

The "true origin" of the fuzzy number is independently drawn from the probability distribution using originalPD function from the stats package with the parameters defined by parOriginalPD. The same applies to the increases of the core (the function incrCorePD with the parameters parIncrCorePD is then used), the left increase of the support (the function suppLeftPD with the parameters parSuppLeftPD, respectively), and the right increase of the support (the function suppRightPD with the parameters parSuppRightPD, respectively).

Value

The output is given as a list with values: original - a vector with "true origins" of the simulated fuzzy numbers generated from the probability distribution originalPD, and value – a list of the simulated triangular, trapezoidal, or PLFN fuzzy number as in the FuzzyNumbers package.

References

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap Methods for Epistemic Fuzzy Data. International Journal of Applied Mathematics and Computer Science, 32(2)

Grzegorzewski, P., Romaniuk, M. (2022) Bootstrap methods for fuzzy data. Uncertainty and Imprecision in Decision Making and Decision Support: New Advances, Challenges, and Perspectives, pp. 28-47 Springer

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

Parchami, A., Grzegorzewski, P., Romaniuk, M. (2024) Statistical simulations with LR random fuzzy numbers. Statistical Papers

See Also

SimulateFuzzyNumber for generation of the single random fuzzy number

Examples

# seed PRNG

set.seed(1234)

# generate 10 triangular fuzzy numbers (the normal distribution for the "true origin",
# and two different uniform distribution for the increases of the support)

SimulateSample(n=10,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="triangular")

# generate 20 trapezoidal fuzzy number (the normal distribution for the "true origin",
# the exponential distribution for the increases of the core,
# and two different uniform distribution for the increases of the support)

SimulateSample(n=20,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
type="trapezoidal")

# generate 5 PLFN fuzzy numbers with two knots

SimulateSample(n=5,originalPD="rnorm",parOriginalPD=list(mean=0,sd=1),
incrCorePD="rexp", parIncrCorePD=list(rate=2),
suppLeftPD="runif",parSuppLeftPD=list(min=0,max=0.6),
suppRightPD="runif", parSuppRightPD=list(min=0,max=0.6),
knotNumbers = 2,
type="PLFN")