[R] Re sampling from an ECDF

Charles C. Berry cberry at tajo.ucsd.edu
Thu Dec 4 17:11:39 CET 2008


On Thu, 4 Dec 2008, Spiderschwein wrote:

>
> Say F_n is my ecdf, generated from my sample x.
> With sample(x, 2000, replace = TRUE) I get a uniformly distributed sample
> from x.
>

Which is not the same as uniformly from unique(x).

> But I need a (re)sample, which is F_n distributed.
> Now I'm confused, if that makes a difference or not...

Just recognize that

> tab <- table(x)
> sample( as.numeric(names(tab)), 10, prob=tab, repl=TRUE )

and

> sample( x, 10 , repl=TRUE )

are both samples from the same population, and your confusion will abate.

:-)

Chuck


>
> Regards,
> Martin
>
>
>
> Dimitris Rizopoulos-4 wrote:
>>
>> say 'x' is your sample, then try
>>
>> sample(x, 2000, replace = TRUE)
>>
>>
>> I hope it helps.
>>
>> Best,
>> Dimitris
>> --
>> Dimitris Rizopoulos
>> Assistant Professor
>> Department of Biostatistics
>> Erasmus Medical Center
>>
>> Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
>> Tel: +31/(0)10/7043478
>> Fax: +31/(0)10/7043014
>>
>> ______________________________________________
>> 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.
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Resampling-from-an-ECDF-tp20831433p20835550.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list