Re: [R] Resshufling algorithm (Thiago Souza)

From: Bernardo Rangel Tura <tura_at_centroin.com.br>
Date: Sat, 19 Jul 2008 12:26:38 -0300

Em Sáb, 2008-07-19 às 11:07 -0300, Thiago Souza escreveu:
> Hi folks!
>
> I'm a beginner and I'm learning how to use R.
>
> I need to calculate the value of Simpson Diversity Index (*D*=1-Σ*pi*^2;
> where *p* is the relative abundance of the species* i*) of one sample (e.g.,
> diversity of bromeliad spiders) and test the significance of this value. For
> this I'll need to randomize samples while conserving the observed species
> abundance and sample-size distributions. After this, in need to repeate
> these randomizations 10.000 times to form a null distribution and assessing
> the statistical significance by compare the observad D value with the null
> distribution.
> But unfortunately, I don't know how to run this procedure in R software.
>
> Please, can anybody help me?
>
> Thank you in advance
>

Thiago,

If I understood your problem do you solve using sample, look this example

data<-rep(letters[1:6],10)

sample<-sample (data,10)
sample
table(sample)

sample<-sample (data,10)
sample
table(sample)

For repeat the sample using "for"

for (i in 1:10000){
commands
}

-- 
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil

______________________________________________
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 Sat 19 Jul 2008 - 15:31:32 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 Sat 19 Jul 2008 - 16:31:49 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