Hi r-users,
 
I have 2 sets of data and I would like to superimpose this cumulative density 
in one graph.
 
I know how to put the 2 graphs in one same graph but my problem is the data are 
different.
 
> z[1:20]
 [1]  2.02347388  3.19514379  0.05188875  1.41333812  3.50249892  4.34272676  
6.65639581  5.01533819  4.18207505
[10]  2.87615551  2.28202152  0.49431541  0.06570579  5.68352438 11.37222124  
7.29185093  4.32209430  2.65243100
[19]  4.60515744  2.25838285
 
       zgen   dgen
 [1,] 10.04 0.9627
 [2,] 10.05 0.9629
 [3,] 10.06 0.9631
 [4,] 10.07 0.9632
 [5,] 10.08 0.9634
 [6,] 10.09 0.9635
 [7,] 10.10 0.9637
 [8,] 10.11 0.9638
 [9,] 10.12 0.9640
[10,] 10.13 0.9642
[11,] 10.14 0.9643
 
For z data, I can simply plot(ecdf(z)).  But for data gen it is a 2 coulumn 
data, if I use scatter plot I can get the cdf, plot(zgen,dgen).
 
I tried:
 
plot(ecdf(z), verticals= TRUE,do.p = FALSE, main ="CDF for observed and 
simulated weighted sum",
xlab="Weighted sum (mm)", ylab="Cumulative Percent", xlim=c(0,30), xaxs ='i', 
yaxs ='i')
lines(c(zgen,dgen),verticals= TRUE,do.p = FALSE,col.h="red",col.v="red",lwd=2)
legend(10,.2,c("obs","pre"),col=c("black","red"),lwd=c(1,2))
 
I do not get what I want.
So how do I draw the 2 different ecdf on the same graph given 2 different set 
of data.
 
 
Thank you so much for your help.
 
 
 
 

 


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to