c2m: Compares 2 mean values using a randomization test

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Mean values of 2 populations are compared using a randomization procedure. Overlapping populations are allowed.

Usage

1
c2m(pop1, pop2,pop3=NULL,nrandom,pr1=0.025,pr2=0.975,verbose=TRUE)

Arguments

pop1

A vector with the observed values for population 1.

pop2

A vector with the observed values for population 2.

pop3

A vector with the observed values that are common to population 1 and 2.

nrandom

Number of randomizations to perform. Default fixed to 99.

pr1

Lower probability level for quantile computations. Default fixed to 0.025.

pr2

Higher probability level for quantile computations. Default fixed to 0.975.

verbose

If verbose is TRUE c2m returns a vector that contains the observed and randomized differences between mean richnesses.

Details

This randomization test compares the average value of a quantitative variable sampled in 2 populations. Details are available in Manly (1997). In some cases, populations share some observed values: for example if we compare the mean annual temperature of sites where either species A or B is present and if A and B are sympatric in some localities (see example below). Those shared values are passed to c2m by the argument pop3.
If the mean value for population 1 mean value for population 2, p is the number of randomizations for which the mean value for population 1 mean value for population 2 divided by the number of randomizations + 1. If the mean value for population 1 mean value for population 2, p is the number of randomizations for which the mean value for population 1 mean value for population 2 divided by the number of randomizations + 1. If mv1 = mv2 p in not computed (p=NC).

Value

res

A data frame showing the outputs of the randomization test:
mv1 Observed mean values over samples forming population 1.
mv2 Observed mean values over samples forming population 2.
mv1-mv2 Difference between observed mean values of population 1 and population 2.
p Probability of encountering such a value for mv1-mv2 (see details above).
quantile for pr1 Quantile value for probability level pr1.
quantile for pr2 Quantile value for probability level pr2.
randomized mv1-mv2 Mean values of randomized and the observed values.
nrandom Number of randomizations used in the test.

rand

A vector of nrandom+1 values corresponding to the observed difference of mv1-mv2 and the randomized values. rand is available if verbose == TRUE.

Note

The observed difference between populations is included in the numerator and the denominator when computing the probability p. This is justified because if the null hypothesis (there is no difference between populations) is true then the observed difference between populations is just another value for the randomization distribution (Manly, 1997, p. 7).

Author(s)

Jean-Pierre Rossi, <jean-pierre.rossi@supagro.inra.fr>

References

Manly, B.F.J. (1997). Randomization and Monte Carlo methods in biology. Chapman & Hall.

See Also

c2cv, rich

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
## Not run: 
# The example of mandible length of male and female 
# golden jackals from Manly (1997), p.4.
males<-c(120, 107, 110, 116, 114, 111, 113, 117, 114, 112)
females<-c(110, 111, 107, 108, 110, 105, 107, 106, 111, 111)
out <- c2m(pop1=males, pop2=females, nrandom=99)
out$res
hist(out$rand)
abline(v=out$res[3,1], col="red")
abline(v=out$res[5,1], col="blue")
abline(v=out$res[6,1], col="blue")

# Compare simulated datasets
pop1<-rnorm(10)
pop2<-rnorm(10)
out <- c2m(pop1=pop1, pop2=pop2, nrandom=99)
out$res
hist(out$rand)
abline(v=out$res[3,1], col="red")
abline(v=out$res[5,1], col="blue")
abline(v=out$res[6,1], col="blue")


# Maximum temperature in a set of sites where the bark beetle Tomicus destruens
# or T. piniperda are present. Both species are present at 4 sites.
data(Tomicus)
out <- c2m(pop1=Tomicus$destruens,pop2=Tomicus$piniperda, 
pop3=Tomicus$both, nrandom=99)
out$res
hist(out$rand)
abline(v=out$res[3,1], col="red")
abline(v=out$res[5,1], col="blue")
abline(v=out$res[6,1], col="blue")

# using c2m with outputs of rich
data(ef)
o1 <- rich(matrix=ef, nrandom=99, verbose=TRUE)
data(ea)
o2 <- rich(matrix=ea, nrandom=99, verbose=TRUE)
out <- c2m(pop1=o1$sumrow, pop2=o2$sumrow, nrandom=999, verbose=TRUE)
hist(out$rand)
abline(v=out$res[3,1], col="red")
abline(v=out$res[5,1], col="blue")
abline(v=out$res[6,1], col="blue")

## End(Not run)

rich documentation built on May 2, 2019, 5:25 p.m.