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:9.478547 95CI:[ 8.088421,10.824165]
## Distribution: C1
## Mean:10.361572 95CI:[ 8.743345,11.907939]
## Distribution: C3
## Mean:50.051011 95CI:[ 48.373037,51.701994]
## Distribution: C4
## Mean:68.996651 95CI:[ 67.315778,70.444808]
## Distribution: C5
## Mean:88.574355 95CI:[ 87.074630,90.092419]
## =======================================================
## Mean difference of C1 (n=100) minus C2 (n=100): C2 ⊀ C1
##  :p-val 0.2792
## Mean Diff:0.883026 95CI:[ -1.385947,2.965979]
## 
## Mean difference of C3 (n=100) minus C2 (n=100): C2 ≺ C3
##  :p-val 0.0000
## Mean Diff:40.572464 95CI:[ 38.269065,42.704785]
## 
## Mean difference of C4 (n=100) minus C2 (n=100): C2 ≺ C4
##  :p-val 0.0000
## Mean Diff:59.518104 95CI:[ 57.578069,61.602378]
## 
## Mean difference of C5 (n=100) minus C2 (n=100): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:79.095808 95CI:[ 77.029309,81.077312]
## 
## Mean difference of C3 (n=100) minus C1 (n=100): C1 ≺ C3
##  :p-val 0.0000
## Mean Diff:39.689438 95CI:[ 37.417878,42.074313]
## 
## Mean difference of C4 (n=100) minus C1 (n=100): C1 ≺ C4
##  :p-val 0.0000
## Mean Diff:58.635078 95CI:[ 56.554303,60.875913]
## 
## Mean difference of C5 (n=100) minus C1 (n=100): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:78.212783 95CI:[ 76.000588,80.465584]
## 
## Mean difference of C4 (n=100) minus C3 (n=100): C3 ≺ C4
##  :p-val 0.0000
## Mean Diff:18.945640 95CI:[ 16.509910,21.229508]
## 
## Mean difference of C5 (n=100) minus C3 (n=100): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:38.523344 95CI:[ 36.238993,40.718251]
## 
## Mean difference of C5 (n=100) minus C4 (n=100): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:19.577704 95CI:[ 17.436303,21.787033]

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: C3
## Mean:81.965329 95CI:[ 79.684482,84.201910]
## Distribution: C1
## Mean:83.922635 95CI:[ 81.127072,87.134433]
## Distribution: C2
## Mean:84.714451 95CI:[ 81.508869,89.408811]
## Distribution: C4
## Mean:99.375923 95CI:[ 79.082758,136.407165]
## Distribution: C5
## Mean:141.759356 95CI:[ 140.025394,143.293224]
## =======================================================
## Mean difference of C1 (n=1200) minus C3 (n=1200): C3 ⊀ C1
##  :p-val 0.5201
## Mean Diff:1.957306 95CI:[ -1.668041,6.520992]
## 
## Mean difference of C2 (n=1200) minus C3 (n=1200): C3 ⊀ C2
##  :p-val 0.1706
## Mean Diff:2.749122 95CI:[ -1.425132,8.078486]
## 
## Mean difference of C4 (n=1200) minus C3 (n=1200): C3 ⊀ C4
##  :p-val 0.4831
## Mean Diff:17.410594 95CI:[ -3.455819,54.944898]
## 
## Mean difference of C5 (n=1200) minus C3 (n=1200): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:59.794028 95CI:[ 57.066335,62.472620]
## 
## Mean difference of C2 (n=1200) minus C1 (n=1200): C1 ⊀ C2
##  :p-val 0.1531
## Mean Diff:0.791816 95CI:[ -4.296295,6.269285]
## 
## Mean difference of C4 (n=1200) minus C1 (n=1200): C1 ⊀ C4
##  :p-val 0.4841
## Mean Diff:15.453288 95CI:[ -5.649505,64.569232]
## 
## Mean difference of C5 (n=1200) minus C1 (n=1200): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:57.836721 95CI:[ 54.038014,61.191895]
## 
## Mean difference of C4 (n=1200) minus C2 (n=1200): C2 ⊀ C4
##  :p-val 0.8261
## Mean Diff:14.661472 95CI:[ -7.188121,52.267271]
## 
## Mean difference of C5 (n=1200) minus C2 (n=1200): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:57.044905 95CI:[ 51.614078,60.727540]
## 
## Mean difference of C5 (n=1200) minus C4 (n=1200): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:42.383434 95CI:[ 6.124879,62.913556]
plot(A3)

end_time <- Sys.time()
end_time - start_time
## Time difference of 3.301037 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()`).