GoodnessFit {SGB} | R Documentation |
Goodness of fit tests on the marginal distributions of each part in a SGB model
Description
Kolmogorov-Smirnov goodness of fit tests
Cramer-von-Mises goodness of fit tests.
Usage
ks.SGB(u,shape1,shape2,scale,alpha=0.05)
cvm.SGB(u,shape1,shape2,scale,alpha=0.05)
## S3 method for class 'testSGB'
print(x,...)
Arguments
u |
data matrix of compositions (independent variables) |
shape1 |
positive number, overall shape parameter of the SGB distribution. See |
shape2 |
vector of length |
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. |
Details
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.
Value
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 |
A print method exists for the class "testSGB".
References
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.
See Also
SGBdistrib
for the theoretical distribution, oilr
for the regression results.
Examples
## 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"]])