[R] Resshufling algorithm (Thiago Souza)

2008-07-19 Thread Thiago Souza
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 Gonçalves-Souza

[[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.


Re: [R] Resshufling algorithm (Thiago Souza)

2008-07-19 Thread Bernardo Rangel Tura
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:1){
commands
}


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

__
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.