Two sample Kolmogorov-Smirnov plot in R (using raw data)

110 views Asked by At

I'm interested in replicating this plot (two-sample Kolmogorov-Smirnov plot) for my data, but they use a "rnorm" example. Is this possible to do with raw data (preferably in ggplot as well)? I can't seem to replicate the variables using the ecdf and cdf1 functions (possibly because of duplicate values and/or small sample sizes(?).

My data:

> dry_2006 <- do.call(cbind.data.frame, dry_2006)
> class(dry_2006)
[1] "data.frame"
> dput(dry_2006)
structure(list(CYR = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), levels = c("2006", "2015", "2016", 
"2018"), class = "factor"), Month = c(3, 3, 2, 3, 3, 3, 2, 2, 
3, 2, 3, 2, 2, 3, 2, 3, 3, 2, 2, 3, 2, 3, 3, 2, 2, 2, 3, 3, 3, 
2, 2, 2, 3, 3, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 3, 3), temp = c(18.66, 
21.36, 25.03, 21.58, 19.24, 19.32, 23.6, 25.57, 21.95, 24.9, 
19.48, 25.82, 25.15, 23.04, 24.18, 22.85, 19.79, 25.72, 25.29, 
23.82, 23.9, 23.37, 20.55, 26.04, 25.88, 24.51, 24.02, 21, 23.79, 
27.16, 26.97, 24.93, 24.17, 23.66, 22.13, 28.06, 27.37, 25.89, 
28.09, 26.83, 25.52, 28.3, 26.58, 28.94, 26.3, 26.48, 24.46)), class = "data.frame", row.names = c(NA, 
-47L))
0

There are 0 answers