Description Usage Arguments Details Value References See Also Examples
Kolmogorov-Smirnov goodness of fit tests
Cramer-von-Mises goodness of fit tests.
1 2 3 4 5 |
u |
data matrix of compositions (independent variables) (N \times D); D: number of parts |
shape1 |
positive number, overall shape parameter of the SGB distribution. See |
shape2 |
vector of length D, Dirichlet shape parameters of the SGB distribution. See |
scale |
matrix of the same dimensions as |
alpha |
overall level of the test, default 0.05. |
x |
an object of class "testSGB". |
... |
further arguments passed to or from other methods. |
ks.SGB
calls ks.test
and cvm.SGB
calls cvm.test
.
Consider z=C[(u/scale)^{shape1}], where C[.] is the closure operation. The scale compositions scale may be modelled with auxiliary variables. Under the SGB hypothesis, the components of z should be marginally beta-distributed. The functions provide D tests, one for each part.
Theoretically, the parameters should be known and not estimated on the data. Thus the test using estimated parameters is conservative.
The cutoff value is based on the false discovery rate for multiple comparisons (Benjamini and Hochberg, 1995), which is simply alpha*i/D
for the i-th ordered p-value, i=1,...,D (number of tests). Reject the null hypothesis if at least one p-value is smaller than the cutoff. The overall level is then alpha
. The proof of the result does not use an independence assumption between the tests.
A list of class 'testSGB' with the following components:
method |
either "One-sample Kolmogorov-Smirnov test" or "Cramer-von Mises test of goodness-of-fit" |
Compositions |
name of the dataset |
tests |
data frame with D rows and 3 columns: test statistics for each part against the beta distribution and corresponding p-values and cutoff. Any p-value smaller than the cutoff means that the assumption of the beta distribution for all the margins is rejected. |
A print method exists for the class "testSGB".
Benjamini, Y. and Y. Hochberg (1995). Controlling the false discovery rate: A practical and powerful approach to multiple testing. Journal of the Royal Statistical Society. Series B (Methodological) 57 (1), 289-300.
Birnbaum, Z. W. and Fred H. Tingey (1951), One-sided confidence contours for probability distribution functions. The Annals of Mathematical Statistics, 22/4, 592-596.
Conover, William J. (1971), Practical Nonparametric Statistics. New York: John Wiley & Sons. Pages 295-301 (one-sample Kolmogorov test), 309-314 (two-sample Smirnov test).
Csorgo, S. and Faraway, J.J. (1996) The exact and asymptotic distributions of Cramer-von Mises statistics. Journal of the Royal Statistical Society, Series B 58, 221-234.
Durbin, J. (1973), Distribution theory for tests based on the sample distribution function. SIAM.
Marsaglia, G., Wai Wan Tsang and Jingbo Wang (2003), Evaluating Kolmogorov's distribution. Journal of Statistical Software, 8/18.
SGBdistrib
for the theoretical distribution, oilr
for the regression results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Generate 1000 random variates according to SGB(shape1,rep(1/3,3),shape2)
shape1 <- 0.6
shape2 <- c(10,20, 30)
rnum <- rSGB(1000,shape1,rep(1,3)/3,shape2)
ks.SGB(rnum,shape1=shape1, shape2=shape2,scale=1)
## same result as
ks.SGB(rnum,shape1=shape1,scale= matrix(rep(1/3,3000),ncol=3), shape2=shape2)
library(goftest)
cvm.SGB(rnum,shape1=shape1,scale= matrix(rep(1/3,3000),ncol=3), shape2=shape2)
## Arctic lake data
# oilr is a SGB regression object, see \code{\link{oilr}}.
data(oilr) # regSGB object
data(arc)
ua <- arc[1:3] # compositions
## Kolmogorov-Smirnov goodness of fit test
ks.SGB(ua,shape1=oilr[["par"]][1],shape2=oilr[["par"]][4:6],scale=oilr[["scale"]])
## Rounding shape1 affects the results less than rounding shape2.
ks.SGB(ua,shape1=round(oilr[["par"]][1],3),shape2=round(oilr[["par"]][4:6],1),
scale=oilr[["scale"]])
ks.SGB(ua,shape1=round(oilr[["par"]][1],1),shape2=round(oilr[["par"]][4:6],3),
scale=oilr[["scale"]])
## Cramer-von-Mises goodness of fit test
library(goftest)
cvm.SGB(ua,shape1=oilr[["par"]][1],shape2=oilr[["par"]][4:6],scale=oilr[["scale"]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.