S.nd {L2DensityGoFtest} | R Documentation |
Density goodness-of-fit test statistic based on discretized L2 distance
Description
Implements the multivariate (d >=2) density goodness of fit test statistic of Bagkavos, Patil and Wood (2021), based on aggregation of local discrepancies between the fitted parametric density and a nonparametric empirical density estimator.
Usage
S.nd(xin, h, dist, p1, p2)
Arguments
xin |
A matrix (n x d) of data points - the available sample with n rows and d columns, each column corresponds to a different coordinate axis. |
h |
The bandwidth vector to use, typically the output of |
dist |
The null distribution. |
p1 |
Parameter 1 (vector or object) for the null distribution. |
p2 |
Parameter 2 (vector or object) for the null distribution. |
Details
Implements the test statistic used for testing the hypothesis
This density goodness-of-fit test is based on a discretized approximation of the L2 distance. Assuming that is the number of observations and
is the number of bins in which the range of the data is split, the test statistic is:
where is the Epanechnikov kernel implemented in this package with the
Epanechnikov
function. The null model is specified through the
dist
argument with parameters passed through the p1
and p2
arguments. The test is implemented either with bandwidth hopt.edgeworth
or with bandwidth hopt.be
which provide the value of needed for calculation of
and the critical value used to determine acceptance or rejection of the null hypothesis.
Value
A vector with the value of the test statistic as well as the Delta value used for its calculation
Author(s)
R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com>
References
Bagkavos, Patil and Wood: Nonparametric goodness-of-fit testing for a continuous multivariate parametric model, (2021), under review.
See Also
Examples
library(mvtnorm)
sigma <- matrix(c(4,2,2,3), ncol=2)
x <- rmvnorm(n=100, mean=c(1,2), sigma=sigma)
h.be1 <- hopt.be(x[,1])
h.be2 <- hopt.be(x[,2])
h<-c(h.be1, h.be2)
Nulldist<-"normal"
S.nd(x, h, Nulldist, c(1,2), sigma)