CVMgof2 | R Documentation |
Performs the one-sample Cramér–von Mises goodness-of-fit (GoF) test to assess whether a sample comes from a specified distribution using asymptotic p-value approximations.
CVMgof2(
x,
dist = c("norm", "exp", "unif", "lnorm", "weibull", "gamma", "t", "chisq"),
...,
eps = 1e-15
)
x |
A numeric vector of observations. |
dist |
A character string specifying the theoretical distribution. Must be one of
|
... |
Distribution parameters passed to the corresponding |
eps |
A small value to truncate extreme p-values (default is |
The test uses the Cramér–von Mises statistic to assess how well the empirical distribution function (EDF) of the sample agrees with the cumulative distribution function (CDF) of the specified theoretical distribution. The p-value is computed using approximation formulas derived from the asymptotic distribution of the test statistic.
An object of class "htest"
with the following components:
The computed Cramér–von Mises test statistic.
The asymptotic p-value.
A description of the test and distribution.
The name of the data vector.
set.seed(123)
x1 <- rnorm(500, mean = 0, sd = 1)
CVMgof2(x1, dist = "norm", mean = 0, sd = 1)
x2 <- rexp(500, rate = 2)
CVMgof2(x2, dist = "exp", rate = 2)
x3 <- runif(200, min = -1, max = 3)
CVMgof2(x3, dist = "unif", min = -1, max = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.