Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples
Given a sample of a continuous univariate random variable and a density
function fun.den
with support in the interval (lower
, upper
)),
fan.test
considers the test whose null hypothesis is that the sample has fun.den
as density function
and the test statistic and the corresponding p-value of the test based on the integral of the squared difference between
the null hypothesis density function and a kernel smoothing approximation.
To properly run, the KernSmooth
package needs to be
installed, as in its default option it depends on the dpik
function to estimate the bandwidth.
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 |
kernel |
a character string with the kernel to be used, either "normal" (a N(0,1) density), "box" (a uniform in -1 to 1) or "epanech" (a Epanechnikov quadratic kernel), default "normal". |
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 is estimated using the |
The Fan's test is based on a normal approximation of the integral of the squared difference between the null hypothesis density function and a kernel smoothing approximation. In Li and Racine's form it is obtained as the aggregation of (i) a sampling component, (ii) the integrate of the square of the kernel convolution of the density null function and (iii) the sum of the convolution of the density in the sampled values, see Li and Racine (2007, pp.380-1) for details.
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. |
fan.test
calls the dpik
function of KernSmooth
To properly run the function requires the package KernSmooth
to be installed to estimate the bandwidth.
Jose M. Pavia
Fan, Y (1994) "Testing the goodness-of-fit of a parametric density function by kernel method", Econometric Theory, 10, 316–356.
Li, O. and Racine, J.F. (2007) "Nonparametric Econometrics", Princeton niversity Press, New Jersey.
dgeometric.test
, integrate
and dpik
.
1 2 3 4 5 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.