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:9.260317 95CI:[ 7.664498,10.789098]
## Distribution: C2
## Mean:10.529497 95CI:[ 9.092025,12.002193]
## Distribution: C3
## Mean:49.579298 95CI:[ 48.137093,51.046096]
## Distribution: C4
## Mean:69.204164 95CI:[ 67.545335,70.950882]
## Distribution: C5
## Mean:90.816464 95CI:[ 89.286640,92.198111]
## =======================================================
## Mean difference of C2 (n=100) minus C1 (n=100): C1 ⊀ C2
##  :p-val 0.1453
## Mean Diff:1.269180 95CI:[ -0.907067,3.367804]
## 
## Mean difference of C3 (n=100) minus C1 (n=100): C1 ≺ C3
##  :p-val 0.0000
## Mean Diff:40.318981 95CI:[ 38.148509,42.347599]
## 
## Mean difference of C4 (n=100) minus C1 (n=100): C1 ≺ C4
##  :p-val 0.0000
## Mean Diff:59.943847 95CI:[ 57.604215,62.169731]
## 
## Mean difference of C5 (n=100) minus C1 (n=100): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:81.556147 95CI:[ 79.567949,83.757230]
## 
## Mean difference of C3 (n=100) minus C2 (n=100): C2 ≺ C3
##  :p-val 0.0000
## Mean Diff:39.049801 95CI:[ 36.869842,41.110132]
## 
## Mean difference of C4 (n=100) minus C2 (n=100): C2 ≺ C4
##  :p-val 0.0000
## Mean Diff:58.674668 95CI:[ 56.270338,60.994255]
## 
## Mean difference of C5 (n=100) minus C2 (n=100): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:80.286968 95CI:[ 78.064940,82.382646]
## 
## Mean difference of C4 (n=100) minus C3 (n=100): C3 ≺ C4
##  :p-val 0.0000
## Mean Diff:19.624866 95CI:[ 17.546456,21.923513]
## 
## Mean difference of C5 (n=100) minus C3 (n=100): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:41.237166 95CI:[ 39.132802,43.254332]
## 
## Mean difference of C5 (n=100) minus C4 (n=100): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:21.612300 95CI:[ 19.341510,23.951299]

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: C2
## Mean:77.341961 95CI:[ 69.888095,82.518173]
## Distribution: C1
## Mean:81.405171 95CI:[ 77.594162,84.998632]
## Distribution: C4
## Mean:82.231484 95CI:[ 80.707939,83.590435]
## Distribution: C3
## Mean:84.562085 95CI:[ 82.810030,86.893900]
## Distribution: C5
## Mean:142.645308 95CI:[ 140.810160,144.412114]
## =======================================================
## Mean difference of C1 (n=1200) minus C2 (n=1200): C2 ⊀ C1
##  :p-val 0.8543
## Mean Diff:4.063210 95CI:[ -2.400854,12.341032]
## 
## Mean difference of C4 (n=1200) minus C2 (n=1200): C2 ⊀ C4
##  :p-val 0.7659
## Mean Diff:4.889523 95CI:[ -0.834554,12.339230]
## 
## Mean difference of C3 (n=1200) minus C2 (n=1200): C2 ⊀ C3
##  :p-val 0.4619
## Mean Diff:7.220125 95CI:[ 1.232252,14.845405]
## 
## Mean difference of C5 (n=1200) minus C2 (n=1200): C2 ≺ C5
##  :p-val 0.0000
## Mean Diff:65.303348 95CI:[ 59.376548,73.194096]
## 
## Mean difference of C4 (n=1200) minus C1 (n=1200): C1 ⊀ C4
##  :p-val 0.3902
## Mean Diff:0.826313 95CI:[ -2.596298,4.663979]
## 
## Mean difference of C3 (n=1200) minus C1 (n=1200): C1 ⊀ C3
##  :p-val 0.1288
## Mean Diff:3.156915 95CI:[ -0.906571,7.457507]
## 
## Mean difference of C5 (n=1200) minus C1 (n=1200): C1 ≺ C5
##  :p-val 0.0000
## Mean Diff:61.240138 95CI:[ 57.470292,65.204681]
## 
## Mean difference of C3 (n=1200) minus C4 (n=1200): C4 ⊀ C3
##  :p-val 0.2001
## Mean Diff:2.330602 95CI:[ 0.031537,4.898309]
## 
## Mean difference of C5 (n=1200) minus C4 (n=1200): C4 ≺ C5
##  :p-val 0.0000
## Mean Diff:60.413825 95CI:[ 58.274189,62.784236]
## 
## Mean difference of C5 (n=1200) minus C3 (n=1200): C3 ≺ C5
##  :p-val 0.0000
## Mean Diff:58.083223 95CI:[ 55.285846,60.685915]
plot(A3)

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