Description Usage Arguments Details Value Note Author(s) References See Also Examples
Implementation of the goodness-of-fit test based on assessing the size of the area between the null hypothesis density function and a kernel density estimate of a sample.
1 2 |
x |
a numeric vector of data values for which the null hypothesis is tested. |
fun.den |
an actual density distribution function, such as |
par |
list of (additional) parameters of the density function under the null hypothesis, default NULL. |
lower |
lower end point of the support of the random variable defined by |
upper |
upper end point of the support of the random variable defined by |
n.sim |
number of iterations performed to calculate the |
bw |
a number indicating the bandwidth to be used in the empirical kernel estimate of the data,
default NULL. In its default option, the bandwidth varies in each simulated dataset and is the one
estimated by default by |
dgeometric.test
uses numerical integration and Monte Carlo simulation to implement
the test based on assessing the extend of the area between a null hypothesis density function
and a density kernel estimation. It works as follows. After computing by numerical integration the area
between the density function under the null hypothesis and its sample empirical kernel estimate obtained using
density.reflected
, the p-value
of the test is obtained by simulation as follows:
(i) drawing n.sim
samples from fun.den
with the same size length(x)
of our actual
sample x
; (ii) estimating the kernel density function for each of these new samples;
(iii) computing the area between the theoretical density and each of the estimates obtained in (ii);
and, (iv) calculating the p-value as the proportion of times the sample n.sim
areas computed in (iii) exceed the value of the area computed from the observed sample.
The output is an object of the class htest
exactly like for the Kolmogorov-Smirnov
test, ks.test
.
A list containing the following components:
statistic |
the value of the test statistic. |
p.value |
the p-value of the test. |
method |
the character string "Geometric test". |
data.name |
a character string giving the name of the data. |
dgeometric.test
calls density.reflected
and area.between
(and, in some circunstances, also inverse
, random.function
and support.facto
),
which are (internal) functions of the package GoFKernel
.
Jose M. Pavia
Pavia, JM (2015) "Testing Goodness-of-fit with the Kernel Density Estimator: GoFKernel", Journal of Statistical Software, Code Snippets, 66(1), 1–27.
area.between
, density.reflected
, inverse
random.function
, support.facto
and fan.test
.
1 2 3 4 5 6 7 8 | set.seed(12)
x <- rlnorm(50, meanlog=1, sdlog=1)
## test if x follows a Gamma distribution with shape .6 and rate .1
dgeometric.test(x, dgamma, par=list(shape=0.6, rate=0.1), lower=0, upper=Inf, n.sim=100)
f0 <- function(x) ifelse(x>=0 & x<=1, 2-2*x, 0)
## test if risk76.1929 follows the distribution characterized by f0
dgeometric.test(risk76.1929, f0, lower=0, upper=1, n.sim=21)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.