ks2d1p: A permutation test to compute a p-value for the D test...

View source: R/ks2d.R

ks2d1pR Documentation

A permutation test to compute a p-value for the D test statistic for the one-sample two-dimensional Kolmogrov-Smirnov test.

Description

A permutation test to compute a p-value for the D test statistic for the one-sample two-dimensional Kolmogrov-Smirnov test.

Usage

ks2d1p(object, B = 100)

## S3 method for class 'ks2d1p'
print(x, ...)

## S3 method for class 'ks2d1p'
plot(x, xlab = "D Test Statistic", main = "", ...)

Arguments

object

An object returned from ks2d1.

B

A numeric representing the number of resamples.

x

An object returned from ks2d1p.

...

Additional arguments sent to the plot function.

xlab

A string to label the x-axis.

main

A string to label the main title on the plot.

Details

NEED DETAIL HERE.

Value

The main function returns a list with the following items:

  • D The D test statistic from the ks2d2 object.

  • pval The p-value from the permutation test. See details.

  • Ds The D test statistics from each of the B ‘resamples’.

  • B The B value supplied by the user.

The plot function returns a density plot of the D test statistics from each of the B ‘resamples’ with the observed D test statistic shown with a vertical line. The print function prints the results in a nice format).

Note

This function is experimental at best at this point.

Author(s)

Derek H. Ogle, dogle@northland.edu, with significant help from Ben Bolker.

References

Garvey, J.E., E.A. Marschall, and R.A. Wright. 1998. From star charts to stoneflies: detecting relationships in continuous bivariate data. Ecology 79:442 447.

Press, W.H., S.A. Teukolsky, W.T. Vetterling, B.P. Flannery. 2007. Numerical Recipes: The Art of Scientific Computing, 3rd Edition. Cambridge University Press. 1286 pages.

See Also

ks2d1

Examples

data(Garvey4a)

# Results from the main 1-sample 2-D KS test from ks2d1
( res1 <- with(Garvey4a,ks2d1(shad,sunfish)) )
plot(res1,xlab="Shad Densitiy",ylab="Sunfish Density")

# permutation test using resampling
( res1p <- ks2d1p(res1,B=10) )  # B should be >1000, used 10 here to save time
plot(res1p)


droglenc/FSAmisc documentation built on Jan. 8, 2023, 12:59 a.m.