Learn R Programming

FuzzyImputationTest (version 0.4.0)

CalculateFuzzyMeasures: Calculation of the fuzzy measures for the imputed values.

Description

`CalculateFuzzyMeasures` calculates the various types of fuzzy measures between two datasets -- the true and the imputed one.

Usage

CalculateFuzzyMeasures(
  trueData,
  imputedData,
  imputedMask,
  trapezoidal = TRUE,
  ...
)

Value

The output is given as a matrix (the rows are related to various types of the errors, the columns - to the variables and the overall mean).

Arguments

trueData

Name of the input matrix (or data frame) with the true values of the variables.

imputedData

Name of the input matrix (or data frame) with the imputed values.

imputedMask

Matrix (or data frame) with logical values where TRUE indicates the cells with the imputed values.

trapezoidal

Logical value depending on the type of fuzzy values (triangular or trapezoidal ones) in the dataset.

...

Additional parameters passed to other functions.

Details

The procedure calculates different types of the distance measures (Euclidean - the Euclidean measure, AHD - the AHD measure, HSD - the HSD measure), and means of the absolute differences for various fuzzy characteristics (DiffVal - the difference of the value, DiffAmb - the ambiguity, DiffEV - the expected value, DiffWidth - the width) between two datasets - the first one with true values (set by trueData), and the second one (specified by imputedData) with the imputed variables. Only the truly imputed values are taken into account for these calculations. To properly distinguish the real values with their imputed counterparts, the additional matrix imputedMask should be provided. In this matrix, the logical value TRUE points out the cells with the imputed values. Otherwise, FALSE should be used.

All of the input datasets can be given as matrices or data frames.

Examples

Run this code

# seed PRNG

set.seed(1234)

# load the necessary library

library(FuzzySimRes)

# generate sample of trapezoidal fuzzy numbers with FuzzySimRes library

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")

# convert fuzzy data into a matrix

matrix1 <- FuzzyNumbersToMatrix(list1$value)

# check starting values

head(matrix1)

# add some NAs to the matrix

matrix1NA <- IntroducingNA(matrix1,percentage = 0.1)

head(matrix1NA)

# impute missing values

matrix1DImp <- ImputationDimp(matrix1NA)

# find cells with NAs

matrix1Mask <- is.na(matrix1NA)

# calculate fuzzy measures for the imputed values

CalculateFuzzyMeasures(matrix1,matrix1DImp,matrix1Mask,trapezoidal=TRUE)



Run the code above in your browser using DataLab