localtest(formula, data = data, der, weights = NULL, nboot = 500,
h0 = -1, h = -1, nh = 30, kernel = "epanech", p = 3, kbin = 100,
rankl = NULL, ranku = NULL, seed = NULL)formula: a sympbolic description
of the model to be fitted.formula.der is NULL. If this term is 0,
the testing procedures is applied for the estimate. If it is 1 or
2, it is designed for the first h is discretised, to speed up computation.kernel = "epanech", where the Epanechnikov
density function kernel will be used. Also, several types of kernel funcitons
can be used: triangular and Gaussian density function,
x value which maximizes the
estimate, first or second derivative (for each level). The default
is the minimum data value.x value which maximizes the
estimate, first or second derivative (for each level). The default
is the maximum data value.localtest can be used to test the equality of the
$M$ critical points estimated from the respective level-specific curves.
Note that, even if the curves and/or their derivatives are different, it is
possible for these points to be equal. For instance, taking the maxima of the first derivatives into account, interest lies in testing the following null hypothesis
$$H_0: x_{01} = \ldots = x_{0M}$$
versus the general alternative
$$H_1: x_{0i} \ne x_{0j} \quad {\rm{for}} \quad {\rm{some}} \quad \emph{i}, \emph{j} \in { 1, \ldots, M}.$$
The above hypothesis is true if $d=x_{0j}-x_{0k}=0$ where
$$(j,k)= argmax \quad (l,m) \quad {1 \leq l otherwise $H_0$ is false. It is important to highlight that, in practice,
the true $x_{0j}$ are not known, and consequently neither is $d$,
so an estimate $\hat d = \hat x_{0j}-\hat x_{0k}$ is used, where,
in general, $\hat x_{0l}$ are the estimates of $x_{0l}$ based on the
estimated curves $\hat m_l$ with $l = 1, \ldots , M$. Needless to say,
since $\hat d$ is only an estimate of the true $d$, the sampling
uncertainty of these estimates needs to be acknowledged. Hence, a confidence
interval $(a,b)$ is created for $d$ for a specific level of
confidence (95%). Based on this, the null hypothesis is rejected if
zero is not contained in the interval. Note that if this hypothesis is rejected (and the factor has more than
two levels), one option could be to use the maxp.diff function in
order to obtain the differences between each pair of factor's levels.
library(npregfast)
data(barnacle)
localtest(DW ~ RC : F, data = barnacle, der = 1, seed = 130853, nboot = 100)Run the code above in your browser using DataLab