View source: R/signif_struct.R
| signif_struct | R Documentation |
Calculates the EMD for two matrices x and y and test if the
spatial structure of the two is better than random.
signif_struct(
x,
y,
nrep = 200,
alpha = 0.05,
weight.m = matrix(1, ncol = ncol(x), nrow = ncol(x)) - diag(1, ncol = ncol(x), nrow =
ncol(x)),
plot = TRUE,
verbose = TRUE,
emd.step = 0.002,
save = FALSE,
filename = paste0("test", ifelse(as.png, ".png", ".pdf")),
as.png = TRUE,
png.res = 300,
width = 9,
height = 9,
col = c("#66a182", "#d95f02")
)
x, y |
Two matrices of the same dimensions to compare. |
nrep |
The number of randomisation to perform (Default 1000). |
alpha |
The significance threshold of the test (Default 0.05). |
weight.m |
Matrix of weights. Values should be 'numeric'. |
plot |
A boolean to indicate if the results of the test should be
plotted. Default is |
verbose |
A boolean to indicate if the results of the test should be
printed on the screen (default |
emd.step |
Graphical parameter that defines the width of the histogram bins. |
save |
A boolean to indicate if the diagram should be saved as a pdf file.
Default is |
filename |
An absolute or relative path that indicates where the diagram
should be saved. Also used to specify the name of the file. Default:
the file is saved in the working directory under the name
|
as.png |
A boolean to indicate if the output should be saved as a png.
Default is |
png.res |
The resolution of the png file (default 300 pixels per inch). |
width, height |
The dimensions of the output file in cm (default 9x9cm). |
col |
A vector of two colours to use for significant and non-significant tests, respectively. |
A list containing 3 items: 1. The mean EMD derived the comparison of
x and y. 2. The ensemble of EMDs calculated from the
nrep randomised data. 3. The pvalue of the test.
##> We generate two tables of random, positive data
m1 <- matrix(abs(rnorm(500)), ncol=5) ; m1 <- m1 / apply(m1, 1, sum)
m2 <- matrix(abs(rnorm(500)), ncol=5) ; m2 <- m2 / apply(m2, 1, sum)
signif_struct(m1, m2, plot=FALSE)
res <- signif_struct(m1, m2, plot=TRUE, verbose=TRUE)
res <- signif_struct(m1, 1+m1, plot=TRUE, verbose=TRUE, nrep=100)
str(res)
## Not run:
signif_struct(m1, m2, save=TRUE, filename='test-emd.png')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.