Dear all,
Could anyone help me?

I have a problem with a function I wrote with R.
My scope is to calculate the Levins index B ,
which formula is B=1/sum(*pi*)^2
  *pi  *representing the proportion of individuals feeding on the prey *i *over
the total of analysed individuals.
I used the squared values of    *pi  for calculation.*

I wrote the foolowing code:
x = c(0.001576267,0.024438301,0.04660456,0.015393236,0.354660148)
d = c(5,4,3,2,1)
x[d]
levins <- function(x, d) {
  return(1/sum(x[d]))
}
levins(x)
Once I calculated the function, I must perform a bootstrap on the
estimation obtained in order to calculate the confidence intervals for the
estimation.
So I wrote the following code:
library(boot)
nerit<-boot(x, levins,1000)
b
b$t
neritci<-boot.ci(b, conf = 0.95)


The results obtained are very strange because the results of the function
is 2.25 but the confidence intervals ranged between 0.874 and 16.038.

I' ve read another work similar to mine which used 7 values of prey type
(I've only 5) to calculate Levins index B and their bootstrap values for
confidence intervals are very close to
the real value. So I'm afraid I made some mistake.
Thank you very much in advance.

Larissa

	[[alternative HTML version deleted]]

