Learn R Programming

simba (version 0.3-2)

dfcor: Calculate permuted (Mantel) correlations between one and many variables

Description

The function uses permcor2 to calculate permuted correlation on vectors. One vector is compared to various vectors of the same length. Useful e.g. if one variable has to be tested against various variables.

Usage

dfcor(ox, y, method = "pearson", permutations = 1000, ...)

Arguments

ox
Numeric vector. If it is a similarity matrix (i.e. a dist object, extract vector via as.vector(x) beforehand).
y
A data.frame containing numeric vectors to correlate ox with. Number of rows has to equal the length of x
method
Method for correlation. Defaults to "pearson". See cor for other possibilities.
permutations
Number of permutations. Defaults to 1000, which gives reasonable results and allows to test against alpha = 0.001.
...
Further arguments passed to internal functions (i.e. to cor).

Value

  • A list with the following:
  • callThe function call
  • methodP-value obtained by testing the initial correlation against the permuted correlation values.
  • outA table with statistics. See details below.
  • gesNThe included number of cases.
  • strataThe number of variables against which x was tested.
  • permutationsThe number of permutations.
  • The included printing method gives nice output (where information appears in a slightly different order) ending with the table of out. It is based on a data.frame with nrow = ncol(y) giving the statistics for the correlation between x and each column of y as follows.
  • corrCorrelation value (regarding to method).
  • sigP-value obtained by testing the initial correlation against the permuted correlation values.
  • nopNumber of included pairs. The function tests for complete cases before calculation starts. Pairs containing NA's are not included.
  • missNumber of missing pairs.

encoding

UTF-8

Details

dfcor is a wrapper for permcor2, which is usually called as a part of pcol. Here, the numeric vector in x is compared to each column vector of y.

References

Legendre, P, & Legendre, L. (1998) Numerical Ecology. 2nd English Edition. Elsevier.

See Also

For related functions of simba permcor, permcor2, mancor, pcol. Further see mantel of package vegan for a different implementation of permuted correlation on distance matrices.

Examples

Run this code
## load included data
data(abis)

## obtain several similarity matrices and correlate them
## with one other matrix.
# calculate soerensen similarity for species composition data
abis.soer <- sim(abis.spec, listout = TRUE)[,3]
# calculate euclidean distances between the plot locations
abis.geodist <- dist(abis.env[,1:2])
# calculate the ecological distance according to slope and aspect
abis.aslopect <- with(abis.env, aslopect(aspect, slope))
# calculate the ecological distance according to disturbance
abis.pert <- dist(abis.env[,19-25])

# put distances according to environment together
abis.envdist <- data.frame(dist = c(abis.geodist), 
aslopect = c(abis.aslopect), pert = c(abis.pert))

# no mantel correlation between those constructed
# variables and the similarity in species composition
dfcor(abis.soer, abis.envdist)

Run the code above in your browser using DataLab