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.035787 95CI:[ 8.540435,11.532338]
## Distribution: C1
## Mean:10.807134 95CI:[ 9.391960,12.357982]
## Distribution: C3
## Mean:49.824538 95CI:[ 48.132785,51.521498]
## Distribution: C4
## Mean:68.278542 95CI:[ 66.573013,70.083840]
## Distribution: C5
## Mean:88.784890 95CI:[ 87.290000,90.150737]
## =======================================================
## Mean difference of C1 (n=100) minus C2 (n=100): C2 ⊀ C1
##  :p-val 0.2686
## Mean Diff:0.771347 95CI:[ -1.303297,2.950153]
## 
## Mean difference of C3 (n=100) minus C2 (n=100): C2 ≺ C3
##  :p-val 0.0000
## Mean Diff:39.788752 95CI:[ 37.779170,41.866181]
## 
## Mean difference of C4 (n=100) minus C2 (n=100): C2 ≺ C4
##  :p-val 0.0000
## Mean Diff:58.242756 95CI:[ 56.056895,60.776909]
## 
## Mean difference of C5 (n=100) minus C2 (n=100): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:78.749103 95CI:[ 76.750914,80.915690]
## 
## Mean difference of C3 (n=100) minus C1 (n=100): C1 ≺ C3
##  :p-val 0.0000
## Mean Diff:39.017405 95CI:[ 36.754889,41.106979]
## 
## Mean difference of C4 (n=100) minus C1 (n=100): C1 ≺ C4
##  :p-val 0.0000
## Mean Diff:57.471409 95CI:[ 55.124255,59.635614]
## 
## Mean difference of C5 (n=100) minus C1 (n=100): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:77.977756 95CI:[ 75.839052,80.110390]
## 
## Mean difference of C4 (n=100) minus C3 (n=100): C3 ≺ C4
##  :p-val 0.0000
## Mean Diff:18.454004 95CI:[ 16.125942,20.779343]
## 
## Mean difference of C5 (n=100) minus C3 (n=100): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:38.960352 95CI:[ 36.893785,41.082971]
## 
## Mean difference of C5 (n=100) minus C4 (n=100): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:20.506347 95CI:[ 18.313033,22.749951]

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.500000
## Distribution: C1
## Mean:80.473147 95CI:[ 77.965374,82.717492]
## Distribution: C4
## Mean:80.476973 95CI:[ 78.291104,82.430899]
## Distribution: C3
## Mean:82.022121 95CI:[ 80.267649,83.618340]
## Distribution: C2
## Mean:82.603317 95CI:[ 80.505507,85.207774]
## Distribution: C5
## Mean:143.300857 95CI:[ 139.606327,149.260202]
## =======================================================
## Mean difference of C4 (n=1200) minus C1 (n=1200): C1 ⊀ C4
##  :p-val 0.9137
## Mean Diff:0.003827 95CI:[ -2.959358,3.154755]
## 
## Mean difference of C3 (n=1200) minus C1 (n=1200): C1 ⊀ C3
##  :p-val 0.3314
## Mean Diff:1.548974 95CI:[ -1.294382,4.443768]
## 
## Mean difference of C2 (n=1200) minus C1 (n=1200): C1 ⊀ C2
##  :p-val 0.4959
## Mean Diff:2.130170 95CI:[ -0.956372,5.752865]
## 
## Mean difference of C5 (n=1200) minus C1 (n=1200): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:62.827710 95CI:[ 58.060470,69.141140]
## 
## Mean difference of C3 (n=1200) minus C4 (n=1200): C4 ≺ C3
##  :p-val 0.0335
## Mean Diff:1.545147 95CI:[ -0.974484,4.222956]
## 
## Mean difference of C2 (n=1200) minus C4 (n=1200): C4 ⊀ C2
##  :p-val 0.0775
## Mean Diff:2.126343 95CI:[ -0.655861,5.354379]
## 
## Mean difference of C5 (n=1200) minus C4 (n=1200): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:62.823883 95CI:[ 58.403525,68.472946]
## 
## Mean difference of C2 (n=1200) minus C3 (n=1200): C3 ⊀ C2
##  :p-val 0.6499
## Mean Diff:0.581196 95CI:[ -2.186375,3.665622]
## 
## Mean difference of C5 (n=1200) minus C3 (n=1200): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:61.278736 95CI:[ 57.031492,67.043534]
## 
## Mean difference of C5 (n=1200) minus C2 (n=1200): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:60.697540 95CI:[ 56.164000,66.773728]
plot(A3)

end_time <- Sys.time()
end_time - start_time
## Time difference of 3.175351 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 4 rows containing non-finite outside the scale range
## (`stat_density()`).