Learn R Programming

analogue (version 0.4-0)

mcarlo: Monte Carlo simulation of dissimilarities

Description

Permutations and Monte Carlo simulations to define critical values for dissimilarity coefficients for use in MAT reconstructions.

Usage

mcarlo(object, ...)

## S3 method for class 'default': mcarlo(object, nsamp = 10000, type = c("paired", "complete", "bootstrap", "permuted"), replace = FALSE, method = c("euclidean", "SQeuclidean", "chord", "SQchord", "bray", "chi.square", "SQchi.square", "information", "chi.distance", "manhattan", "kendall", "gower", "alt.gower", "mixed"), is.dcmat = FALSE, diag = FALSE, ...)

## S3 method for class 'mat': mcarlo(object, nsamp = 10000, type = c("paired", "complete", "bootstrap", "permuted"), replace = FALSE, diag = FALSE, ...)

## S3 method for class 'analog': mcarlo(object, nsamp = 10000, type = c("paired", "complete", "bootstrap", "permuted"), replace = FALSE, diag = FALSE, ...)

Arguments

object
an R object. Currently only object's of class "mat", "analog" or matrix-like object of species data allowed.
nsamp
numeric; number of permutations or simulations to draw.
type
character; the type of permutation or simulation to perform. See Details, below.
replace
logical; should sampling be done with replacement?
method
character; for raw species matrices, the dissimilarity coefficient to use. This is predefined when fitting a MAT model with mat or analogue matching via analogue

Value

  • A vector of simulated dissimilarities of length "nsamp". The "method" used is stored in attribute "method".

Details

Only "type" "paired" and "bootstrap" are currently implemented.

distance produces square, symmetric dissimilarity matrices for training sets. The upper triangle of these matrices is a duplicate of the lower triangle, and as such is redundant. mcarlo works on the lower triangle of these dissimilarity matrices, representing all pairwise dissimilarity values for training set samples. The default is not to include the diagonal (zero) values of the dissimilarity matrix. If you feel that these diagonal (zero) values are part of the population of dissimilarities then use "diag = TRUE" to include them in the permutations.

References

Sawada, M., Viau, A.E., Vettoretti, G., Peltier, W.R. and Gajewski, K. (2004) Comparison of North-American pollen-based temperature and global lake-status with CCCma AGCM2 output at 6 ka. Quaternary Science Reviews 23, 87--108.

See Also

mat for fitting MAT models and analog for analogue matching. roc as an alternative method for determining critical values for dissimilarity measures when one has grouped data. plot.mcarlo provides a plotting method to visualise the distribution of simulated dissimilarities.

Examples

Run this code
## continue from example(join)
example(join)

## perform the modified method of Sawada (2004) - paired sampling,
## with replacement
swap.mcarlo <- mcarlo(swapdiat, method = "SQchord", nsamp = 1000,
                      type = "paired", replace = FALSE)
swap.mcarlo

## plot the simulated distribution
par(mfrow = c(2,1))
plot(swap.mcarlo)
par(mfrow = c(1,1))

Run the code above in your browser using DataLab