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? 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) ? thanks! [[alternative HTML version deleted]]
In article <0FF736F1E306A446A88FD41FDDDC10AF1C77B0 at 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
Hello , Can anyone please help me figure out how to do a weighted betabinomial analysis? I mean i have 700 clusters each of size 2 and the response (y[i1]+y[i2]) in each cluster case is either 0,1 or 2. I extract a sample of clusters such that the clusters in which response is 1 or 2 have higher probability of selection but clusters in which response is 0 have lower probability of selection. Now i want to give weight to my sample before i apply betabinomial model to the sampled clusters. what should i do? I would really appreciate any help specially from the authors of package "aod " it would be great if they could tell if it is possible to give some option of weights to "betabin" function like we give in glm function? looking forward for help . thanks!
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 at 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.
Please chk out the url below it might be of some help for plotting step function or *look like* of step function. On Thu, 27 Mar 2008 09:03:58 -0400 wrote: > 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 at BWPW05.f2.enterprise>, > 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.