[R] shading and estimating area abetween two cdf curves
Peter Maclean
pmaclean2011 at yahoo.com
Sat Jan 18 08:37:20 CET 2014
I would like to shade the area between two curves generated by the ecdf function.
There are examples such as those explained here
http://www.alisonsinclair.ca/2011/03/shading-between-curves-in-r/
These examples do not apply to the objects generated by the ecdf function.
#############
library(truncnorm)
x <- rtruncnorm(100, 3, 25, 15, 5)
y <- rtruncnorm(100, 5, 30, 17, 8)
x <- ecdf(x)
y <- ecdf(y)
plot(x)
lines(y)
#This is not working
polygon(x, y, xpd = xpd, col = "orange", lty = 2, lwd = 2, border = "red")
#How to shade the area between the curve
#calculate the area between the two curves
Peter Maclean
Department of Economics
UDSM
More information about the R-help
mailing list