Re: [R] difference between 2 ecdfs

From: <Erwann.Rogard_at_sanofi-aventis.com>
Date: Thu, 27 Mar 2008 09:03:58 -0400

Thanks to David and Zaihra for their help.

Besides plotting the difference between 2 ecdfs, I also would like it to *look like* a step function. Any suggestion?

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of David Winsemius
Sent: Friday, March 21, 2008 8:51 PM
To: r-help_at_stat.math.ethz.ch
Subject: Re: [R] difference between 2 ecdfs

In article
<0FF736F1E306A446A88FD41FDDDC10AF1C77B0@BWPW05.f2.enterprise>,  <Erwann.Rogard_at_sanofi-aventis.com> wrote:

> hi,
>
> a) i have something like:
>
> ecdfgrp1<-ecdf(subset(mydata,TMT_GRP==1)$Y);
>
> ecdfgrp2<-ecdf(subset(mydata,TMT_GRP==2)$Y);
>
> how can i plot the difference between these 2 step functions?
>
> i could begin with ecdfrefl<-function(x){ecdfgrp2(x)-ecdfgrp1(x);} ...
> what next?
>
#not tested ...mydata not provided

ecrange<-range(mydata$Y)

plot(ecdfrefl(seq(from=ecrange[1],to=ecrange[2],by=0.2))

> b) if i have a vector with repeated numeric values how can i get the
> subset without repeated values .e.g (0,4,0,2,2) ----> (0,4,2) ?
>

?unique

> ttt<-c(1,3,5,5,5,7)
> unique(ttt)
[1] 1 3 5 7

--
David Winsemius

______________________________________________
R-help_at_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.

______________________________________________
R-help_at_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.
Received on Thu 27 Mar 2008 - 16:55:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 27 Mar 2008 - 17:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive