mcarlo {analogue}  R Documentation 
Permutations and Monte Carlo simulations to define critical values for dissimilarity coefficients for use in MAT reconstructions.
mcarlo(object, ...)
## Default S3 method:
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, ...)
object 
an R object. Currently only object's of class

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

is.dcmat 
logical; is 
diag 
logical; should the dissimilarities include the diagonal (zero) values of the dissimilarity matrix. See Details. 
... 
arguments passed to or from other methods. 
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.
A vector of simulated dissimilarities of length "nsamp"
. The
"method"
used is stored in attribute "method"
.
The performance of these permutation and simulation techniques still
needs to be studied. This function is provided for pedagogic
reasons. Although recommended by Sawada et al (2004), sampling with
replacement ("replace = TRUE"
) and including diagonal (zero)
values ("diag = TRUE"
) simulates too many zero distances. This
is because the same training set sample can, on occasion be drawn
twice leading to a zero distance. It is impossible to find in nature
two samples that will be perfectly similar, and as such sampling
with replacement and "diag = TRUE"
seems
undesirable at best.
Gavin L. Simpson
Sawada, M., Viau, A.E., Vettoretti, G., Peltier, W.R. and Gajewski, K. (2004) Comparison of NorthAmerican pollenbased temperature and global lakestatus with CCCma AGCM2 output at 6 ka. Quaternary Science Reviews 23, 87–108.
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.
## Imbrie and Kipp example
## load the example data
data(ImbrieKipp)
data(SumSST)
data(V12.122)
## merge training and test set on columns
dat < join(ImbrieKipp, V12.122, verbose = TRUE)
## extract the merged data sets and convert to proportions
ImbrieKipp < dat[[1]] / 100
V12.122 < dat[[2]] / 100
## perform the modified method of Sawada (2004)  paired sampling,
## with replacement
ik.mcarlo < mcarlo(ImbrieKipp, method = "chord", nsamp = 1000,
type = "paired", replace = FALSE)
ik.mcarlo
## plot the simulated distribution
layout(matrix(1:2, ncol = 1))
plot(ik.mcarlo)
layout(1)