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: C1
## Mean:10.742018 95CI:[ 8.986175,12.365999]
## Distribution: C2
## Mean:11.065966 95CI:[ 9.576865,12.564787]
## Distribution: C3
## Mean:51.603205 95CI:[ 49.990481,53.279594]
## Distribution: C4
## Mean:69.095745 95CI:[ 67.737238,70.525011]
## Distribution: C5
## Mean:89.772280 95CI:[ 88.233881,91.399892]
## =======================================================
## Mean difference of C2 (n=100) minus C1 (n=100): C1 ⊀ C2
##  :p-val 0.3412
## Mean Diff:0.323948 95CI:[ -1.913283,2.559042]
## 
## Mean difference of C3 (n=100) minus C1 (n=100): C1 ≺ C3
##  :p-val 0.0000
## Mean Diff:40.861188 95CI:[ 38.458699,43.294945]
## 
## Mean difference of C4 (n=100) minus C1 (n=100): C1 ≺ C4
##  :p-val 0.0000
## Mean Diff:58.353727 95CI:[ 56.223716,60.588726]
## 
## Mean difference of C5 (n=100) minus C1 (n=100): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:79.030262 95CI:[ 76.781013,81.174934]
## 
## Mean difference of C3 (n=100) minus C2 (n=100): C2 ≺ C3
##  :p-val 0.0000
## Mean Diff:40.537239 95CI:[ 38.294577,42.671543]
## 
## Mean difference of C4 (n=100) minus C2 (n=100): C2 ≺ C4
##  :p-val 0.0000
## Mean Diff:58.029778 95CI:[ 55.981389,60.117646]
## 
## Mean difference of C5 (n=100) minus C2 (n=100): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:78.706314 95CI:[ 76.527173,80.798539]
## 
## Mean difference of C4 (n=100) minus C3 (n=100): C3 ≺ C4
##  :p-val 0.0000
## Mean Diff:17.492539 95CI:[ 15.224776,19.541282]
## 
## Mean difference of C5 (n=100) minus C3 (n=100): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:38.169075 95CI:[ 35.741071,40.365887]
## 
## Mean difference of C5 (n=100) minus C4 (n=100): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:20.676536 95CI:[ 18.582157,22.734688]

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:76.965649 95CI:[ 68.781905,82.012903]
## Distribution: C4
## Mean:78.996010 95CI:[ 71.682000,83.113220]
## Distribution: C1
## Mean:79.736582 95CI:[ 77.376071,81.649786]
## Distribution: C2
## Mean:81.306183 95CI:[ 79.061426,83.126002]
## Distribution: C5
## Mean:133.772415 95CI:[ 121.416555,142.420970]
## =======================================================
## Mean difference of C4 (n=1200) minus C3 (n=1200): C3 ⊀ C4
##  :p-val 0.6065
## Mean Diff:2.030362 95CI:[ -7.690280,11.031007]
## 
## Mean difference of C1 (n=1200) minus C3 (n=1200): C3 ⊀ C1
##  :p-val 0.7555
## Mean Diff:2.770933 95CI:[ -2.684017,10.279226]
## 
## Mean difference of C2 (n=1200) minus C3 (n=1200): C3 ⊀ C2
##  :p-val 0.5710
## Mean Diff:4.340534 95CI:[ -1.040693,11.470121]
## 
## Mean difference of C5 (n=1200) minus C3 (n=1200): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:56.806766 95CI:[ 42.218343,68.462406]
## 
## Mean difference of C1 (n=1200) minus C4 (n=1200): C4 ⊀ C1
##  :p-val 0.6608
## Mean Diff:0.740571 95CI:[ -4.503763,8.484605]
## 
## Mean difference of C2 (n=1200) minus C4 (n=1200): C4 ⊀ C2
##  :p-val 0.4767
## Mean Diff:2.310173 95CI:[ -2.754946,10.012478]
## 
## Mean difference of C5 (n=1200) minus C4 (n=1200): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:54.776405 95CI:[ 39.978026,66.853998]
## 
## Mean difference of C2 (n=1200) minus C1 (n=1200): C1 ⊀ C2
##  :p-val 0.3149
## Mean Diff:1.569601 95CI:[ -1.440190,4.629855]
## 
## Mean difference of C5 (n=1200) minus C1 (n=1200): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:54.035834 95CI:[ 41.929989,62.814440]
## 
## Mean difference of C5 (n=1200) minus C2 (n=1200): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:52.466232 95CI:[ 39.039849,61.294954]
plot(A3)

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