russel88 / doc Goto Github PK
View Code? Open in Web Editor NEWDissimilarity Overlap Curve analysis
License: MIT License
Dissimilarity Overlap Curve analysis
License: MIT License
Hi,
I was working with your functions trying to find why Fns value from DOC function differ from matlab. In my case, matlab gives a fns = 0.90494, while a summary of fns from DOC function
Fns Data
Min. :0.0004263 Real:200
1st Qu.:0.0622336
Median :0.0901535
Mean :0.0933056
3rd Qu.:0.1154092
Max. :0.7046036
I think that the mistake is in the DOC.boot function at ## Detect negative slope section. If I change point <- which(slope>0) to point <- which.max(slope>0) it almost mimic the matlab, because I obtain a fns = 0.9407. This change tries to do the same that the find(LocalSlope>0,1,'last')), which, if I am not wrong, should pick the last value (or max in R notation).
I run R with a set.seed(100), and run doc<-DOC(otus,R=200), and then:
xs <- seq(0,1,by=0.001)
LOW <- loess(rJSD~Overlap,data=doc$DO,span=0.2,degree=1,family="symmetric",iterations=4,surface="interpolate")
LOW.P <- data.frame(predict(LOW,xs))
## Detect negative slope
# Smooth prediction
ma <- function(x,n=5){filter(x,rep(1/n,n), sides=2)}
low.ma <- ma(LOW.P[,1])
slope <- diff(low.ma)/diff(xs)
point <- which.max(slope>0) ### modified version
neg.slope <- xs[point[length(point)]]
# Fns
Fns <- sum(doc$DO$Overlap>neg.slope,na.rm=T)/length(doc$DO$Overlap)
Hi,
I am working with your function to do analysis like those proposed in Nature paper. In some cases Matlab needs to much time and I found that in R it can be done faster.
My problem is that I want a different figure than default plot. I run the function with
DOC_out<-DOC(otus,R=100,cores=24) and get the default plot with plot(DOC_out), which is attached. In that plot the median Fns is over 0.95, but if I run median(DOC_out$FNS[,1]) I get 0.8722449. I used a set.seed(100) in my R session.
I think that it is my fault but I cannot see what I am doing wrong, because as you state in this web page the vertical line is the median Fns value from bootstraps.
Another question is: default settings (not R or the number of cores) are the "correct" to "mimic" the original function? And how I should get the P values of original matlab code?
Thank you very much,
Manuel
This error occured when I set cores > 1, because lme4 package could not loaded automatically in tasks. So I modified DOC.boot.R file in line53, as following:
llboot <- foreach(i = 1:R,.options.snow = opts, .packages = "lme4", .export = "mov.avg") %dopar% {
In which I added the .packages parameter, and It works.
Here's my R session info:
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.