EDOIF demo

EXAMPLE#1 Simple Simulation & ordering inference

In the first step, we generate a simple dataset. where C1 and C2 are dominated by C3, C3 is dominated by C4, and is C4 dominated by C5. There is no dominant-distribution relation between C1 and C2.

# Simulation section
nInv<-100
initMean=10
stepMean=20
std=8
simData1<-c()
simData1$Values<-rnorm(nInv,mean=initMean,sd=std)
simData1$Group<-rep(c("C1"),times=nInv)
simData1$Values<-c(simData1$Values,rnorm(nInv,mean=initMean,sd=std) )
simData1$Group<-c(simData1$Group,rep(c("C2"),times=nInv))
simData1$Values<-c(simData1$Values,rnorm(nInv,mean=initMean+2*stepMean,sd=std) )
simData1$Group<-c(simData1$Group,rep(c("C3"),times=nInv) )
simData1$Values<-c(simData1$Values,rnorm(nInv,mean=initMean+3*stepMean,sd=std) )
simData1$Group<-c(simData1$Group, rep(c("C4"),times=nInv) )
simData1$Values<-c(simData1$Values,rnorm(nInv,mean=initMean+4*stepMean,sd=std) )
simData1$Group<-c(simData1$Group, rep(c("C5"),times=nInv) )

The framework is used to analyze the data below.

# Simple ordering inference section
library(EDOIF)
## Loading required package: boot
# parameter setting
bootT=1000 # Number of times of sampling with replacement
alpha=0.05 # significance  significance level

#======= input
Values=simData1$Values
Group=simData1$Group
#=============
A1<-EDOIF(Values,Group,bootT = bootT, alpha=alpha )

We print the result of our framework below.

print(A1) # print results in text
## EDOIF (Empirical Distribution Ordering Inference Framework)
## =======================================================
## Alpha = 0.050000, Number of bootstrap resamples = 1000, CI type = perc
## Using Mann-Whitney test to report whether A ≺ B
## A dominant-distribution network density:0.900000
## Distribution: C2
## Mean:10.205348 95CI:[ 8.408715,12.083504]
## Distribution: C1
## Mean:10.927817 95CI:[ 9.121979,12.680136]
## Distribution: C3
## Mean:50.676843 95CI:[ 49.048143,52.204947]
## Distribution: C4
## Mean:69.385167 95CI:[ 67.653949,71.035159]
## Distribution: C5
## Mean:90.717078 95CI:[ 89.155814,92.382642]
## =======================================================
## Mean difference of C1 (n=100) minus C2 (n=100): C2 ⊀ C1
##  :p-val 0.2520
## Mean Diff:0.722470 95CI:[ -1.870942,3.237569]
## 
## Mean difference of C3 (n=100) minus C2 (n=100): C2 ≺ C3
##  :p-val 0.0000
## Mean Diff:40.471496 95CI:[ 38.105178,42.886043]
## 
## Mean difference of C4 (n=100) minus C2 (n=100): C2 ≺ C4
##  :p-val 0.0000
## Mean Diff:59.179820 95CI:[ 56.673010,61.692258]
## 
## Mean difference of C5 (n=100) minus C2 (n=100): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:80.511731 95CI:[ 78.194083,83.110037]
## 
## Mean difference of C3 (n=100) minus C1 (n=100): C1 ≺ C3
##  :p-val 0.0000
## Mean Diff:39.749026 95CI:[ 37.446381,42.104898]
## 
## Mean difference of C4 (n=100) minus C1 (n=100): C1 ≺ C4
##  :p-val 0.0000
## Mean Diff:58.457350 95CI:[ 56.207246,60.733953]
## 
## Mean difference of C5 (n=100) minus C1 (n=100): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:79.789261 95CI:[ 77.447317,82.214420]
## 
## Mean difference of C4 (n=100) minus C3 (n=100): C3 ≺ C4
##  :p-val 0.0000
## Mean Diff:18.708324 95CI:[ 16.739383,20.931573]
## 
## Mean difference of C5 (n=100) minus C3 (n=100): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:40.040235 95CI:[ 37.806805,42.383302]
## 
## Mean difference of C5 (n=100) minus C4 (n=100): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:21.331911 95CI:[ 18.876543,23.445331]

The first plot is the plot of mean-difference confidence intervals

plot(A1,options =1)

The second plot is the plot of mean confidence intervals

plot(A1,options =2)

The third plot is a dominant-distribution network.

out<-plot(A1,options =3)

EXAMPLE#2 Non-normal-Distribution Simulation & ordering inference

We generate more complicated dataset of mixture distributions. C1, C2, C3, and C4 are dominated by C5. There is no dominant-distribution relation among C1, C2, C3, and C4.

library(EDOIF)
# parameter setting
bootT=1000
alpha=0.05
nInv<-1200

start_time <- Sys.time()
#======= input
simData3<-SimNonNormalDist(nInv=nInv,noisePer=0.01)
Values=simData3$Values
Group=simData3$Group
#=============
A3<-EDOIF(Values,Group, bootT=bootT, alpha=alpha, methodType ="perc")
A3
## EDOIF (Empirical Distribution Ordering Inference Framework)
## =======================================================
## Alpha = 0.050000, Number of bootstrap resamples = 1000, CI type = perc
## Using Mann-Whitney test to report whether A ≺ B
## A dominant-distribution network density:0.400000
## Distribution: C4
## Mean:79.733404 95CI:[ 75.786696,83.281638]
## Distribution: C3
## Mean:82.185816 95CI:[ 80.277867,83.986008]
## Distribution: C1
## Mean:85.480313 95CI:[ 80.575611,94.108595]
## Distribution: C2
## Mean:87.724435 95CI:[ 81.489986,97.809609]
## Distribution: C5
## Mean:139.134886 95CI:[ 136.489689,141.177735]
## =======================================================
## Mean difference of C3 (n=1200) minus C4 (n=1200): C4 ⊀ C3
##  :p-val 0.5710
## Mean Diff:2.452412 95CI:[ -1.192062,6.676887]
## 
## Mean difference of C1 (n=1200) minus C4 (n=1200): C4 ⊀ C1
##  :p-val 0.4473
## Mean Diff:5.746910 95CI:[ -0.678368,14.981346]
## 
## Mean difference of C2 (n=1200) minus C4 (n=1200): C4 ⊀ C2
##  :p-val 0.3910
## Mean Diff:7.991031 95CI:[ 0.232210,18.577008]
## 
## Mean difference of C5 (n=1200) minus C4 (n=1200): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:59.401482 95CI:[ 55.222445,64.271100]
## 
## Mean difference of C1 (n=1200) minus C3 (n=1200): C3 ⊀ C1
##  :p-val 0.3810
## Mean Diff:3.294498 95CI:[ -2.263657,12.493149]
## 
## Mean difference of C2 (n=1200) minus C3 (n=1200): C3 ⊀ C2
##  :p-val 0.3130
## Mean Diff:5.538619 95CI:[ -1.315949,13.848372]
## 
## Mean difference of C5 (n=1200) minus C3 (n=1200): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:56.949070 95CI:[ 54.041367,59.818204]
## 
## Mean difference of C2 (n=1200) minus C1 (n=1200): C1 ⊀ C2
##  :p-val 0.4362
## Mean Diff:2.244121 95CI:[ -7.986262,13.382589]
## 
## Mean difference of C5 (n=1200) minus C1 (n=1200): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:53.654572 95CI:[ 44.297055,59.505930]
## 
## Mean difference of C5 (n=1200) minus C2 (n=1200): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:51.410451 95CI:[ 41.121208,58.568953]
plot(A3)

end_time <- Sys.time()
end_time - start_time
## Time difference of 3.262427 secs

Uniform noise

Generating A dominates B with different degrees of uniform noise

library(ggplot2)

nInv<-1000
simData3<-SimNonNormalDist(nInv=nInv,noisePer=0.01)
#plot(density(simData3$V3))

dat <- data.frame(dens = c(simData3$V3, simData3$V5)
                   , lines = rep(c("B", "A"), each = nInv))
#Plot.
p1<-ggplot(dat, aes(x = dens, fill = lines)) + geom_density(alpha = 0.5) +xlim(-400, 400)+ ylim(0, 0.07) + ylab("Density [0,1]") +xlab("Values") + theme( axis.text.x = element_text(face="bold",  
                                      size=12) )
theme_update(text = element_text(face="bold", size=12)  )
p1$labels$fill<-"Categories"
plot(p1)
## Warning: Removed 5 rows containing non-finite values (`stat_density()`).