kstest: Kolmogorov-Smirnov Test

Description Usage Arguments Value See Also Examples

View source: R/kstest.R

Description

Conduct a two-sample Kolmogorov-Smirnov test and output detailed information on the results, including a plot of the distributions.

Usage

1
2
3
4
5
6
7
8
9
kstest(
  x,
  y,
  ids = c("X", "Y"),
  leg.loc = "right",
  txt.loc = "left",
  cexall = 0.8,
  cexmain = 0.8
)

Arguments

x

A numeric vector representing the values from the first distribution.

y

A numeric vector representing the values from the second distribution.

ids

A character vector of length 2 assigning names to the two distributions.

leg.loc

A character scalar denoting the location of the legend, specified as one of the following: "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" (the default) and "center".

txt.loc

A character scalar denoting the location of additional text, either "left" (the default) or "right".

cexall

A numeric scalar giving the amount by which plotting text and symbols should be magnified, default 0.8.

cexmain

A numeric scalar giving the amount by which the main text heading should be magnified, default 0.8.

Value

A two panel plot of the smoothed probability and cumulative distributions is generated with a vertical line at the maximum distance and a summary of the Kolmogorov-Smirnov test annotated on the plot.

See Also

ks.test.

Examples

1
2
3
myX <- rnorm(50, mean=3)
myY <- rnorm(20, mean=4)
kstest(x=myX, y=myY)

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.