signif_threshold: Calculate an analogy threshold from a compilation of...

View source: R/signif_threshold.R

signif_thresholdR Documentation

Calculate an analogy threshold from a compilation of observations

Description

Calculate an analogy threshold from a compilation of observations

Usage

signif_threshold(
  x,
  nrep = 1000,
  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 = "cornflowerblue"
)

Arguments

x

A matrix of samples (rows) 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 FALSE.

verbose

A boolean to indicate if the results of the test should be printed on the screen (default TRUE).

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 FALSE.

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 'Reconstruction_climate.pdf'.

as.png

A boolean to indicate if the output should be saved as a png. Default is TRUE. If FALSE, the figure is saved as a pdf.

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.

Value

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.

Examples

##> We generate two tables of random, positive data
m1 <- matrix(abs(rnorm(500)), ncol=5) ; m1 <- m1 / apply(m1, 1, sum)
signif_threshold(m1, plot=FALSE)
res <- signif_threshold(m1, plot=TRUE, verbose=TRUE)
str(res)
## Not run: 
  signif_threshold(m1, save=TRUE, filename='test-emd.png')

## End(Not run)


mchevalier2/paleotools documentation built on Jan. 7, 2025, 3:37 a.m.