ks2d2p | R Documentation |
A permutation test to compute a p-value for the D test statistic for the two-sample two-dimensional Kolmogrov-Smirnov test.
ks2d2p( object, B = 100, type = c("resample", "randomize"), randtype = c("discrete", "continuous"), coordX = NULL, coordY = NULL ) ## S3 method for class 'ks2d2p' print(x, ...) ## S3 method for class 'ks2d2p' plot(x, xlab = "D Test Statistic", main = "", ...)
object |
An object returned from |
B |
A numeric representing the number of resamples. |
type |
The type of ‘resampling’ to be conducted. See details. |
randtype |
The type of randomization to use if |
coordX |
A vector of length two giving the minimum and maximum values of the X coordinates when |
coordY |
Same as |
x |
An object returned from |
... |
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. |
NEED DETAIL HERE.
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’.
type The type
supplied by the user.
randtype The randtype
supplied by the user.
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).
This function is experimental at best at this point.
Derek H. Ogle, dogle@northland.edu, with significant help from Ben Bolker.
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.
ks2d2
data(KS2D_NR) # separate into the two sets of coordinates d1 <- subset(KS2D_NR,group=="triangles") d2 <- subset(KS2D_NR,group=="squares") # perform D2KS analysis ( res1 <- ks2d2(d1$x,d1$y,d2$x,d2$y) ) # perform permutation test using resampling ( res1p <- ks2d2p(res1,B=10) ) # B should be >1000, used 10 here to save time plot(res1p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.