Argument | Description |
---|---|
n_peld_mc_samples | Number of samples to be used in approximating the estimated limiting distribution of the parameter estimate under the null. Increasing this value reduces the approximation error of the test statistic. |
nrm_type | The type of norm to be used for the test. Generally the l_p norm |
perf_meas | the preferred measure used to generate the test statistic. |
pos_lp_norms | The index of the norms to be considered. For example if we use the l_p norm, norms_indx specifies the different p’s to try. |
ld_est_meth | String indicating method for estimating the limiting distribution of the test statistic parametric bootstrap or permutation. |
ts_ld_bs_samp | The number of test statistic limiting distribution bootstrap samples to be drawn. |
other_output | A vector indicating additional data that should be returned.
Currently only "var_est" is supported. |
… | Other arguments needed in other places. |
Throughout, we will use a simple data generating mechanism:
There are multiple options when defining a test statistic outside of
the specification of the parameter estimator, Ψ̂ and corresponding IC estimator,
$\hat{IC}$ (which is specified in the
param_est
argument. There are four arguments arguments that
control these options.
The first argument perf_meas
specifies the
performance measure used to define the test statistic.
Loosely defined, a performance measure is a function that provides
information about the performance of a simple test at a specified
alternative. It takes as arguments a norm φ, an alternative x and a limiting distribution P0 and considers the
performance of a test defined by reject if
φ(ψ̂) > cα if
the parameter value ψ was
equal to x. The
perf_meas
specifies which measure of performance to use.
Currently the package has implemented three such measures:
p-value (specified by setting perf_meas = "pval"
):
The p-value of the test if ψ̂ = x, defined by Γ(x, P0) := pr(φ(x) < φ(Z))
where Z ∼ P0
acceptance rate (specified by setting
perf_meas = "est_acc"
): The acceptance rate of the test if
ψ̂, is normally distributed and
centered at x defined by Γ(x, P0) := pr(φ(x + Z) < cα)
where Z ∼ P0 and
cα = Fφ(Z)−1(1 − α)
multiplicative distance (specified by setting
perf_meas = "mag"
): The minimum s such that pr(φ(sx + Z) < cα)
where Z ∼ P0 and
cα = Fφ(Z)−1(1 − α)
is lower than 0.2.
Recommendation: Based on what we know currently, we recommend that users use the multiplicative distance performance measure. The other measures can have limiting distributions that are highly concentrated near 0 which can cause issues when approximating the p-value of the test.
We will discuss specification of the norm in the next section. For more details on the procedure, including why performance measures are good for defining a test statistic, see A general adaptive framework for multivariate point null testing.
Two arguments are used to specify the norm used in defining the test
statistic. The first is nrm_type
which can either be
"ssq"
or "lp"
. These norms are defined as:
"lp"
): $$\ell_p: (x_1, x_2,
\ldots, x_d) \mapsto \sqrt[p]{\sum_{i = 1}^d|x_i|^p} $$"ssq"
): $$\jmath_{p}:(x_1,x_2,\ldots,x_d)\mapsto
\left\{\textstyle\sum_{j=1}^{p}x^2_{(d-j+1)}\right\}^{1/2}$$The choice of p is
specified by the pos_lp_norms
argument. If
pos_lp_norm
is assigned a single value, a non-adaptive
version of the test will be performed. If instead
pos_lp_norm
is assigned multiple arguments an adaptive test
will be carried out. More information can be found in our paper. For the ℓp norm, it is possible
to set p = ∞. To make this
specification in R, include "max"
in the vector of values
assigned to pos_lp_norm
.
The next argument we review specifies the method by which you wish to estimate the limiting distribution of the test statistic (Γ(ψ̂, P̂0)). There are two options for this argument:
ld_est_meth = "par_boot"
): When using the parametric
bootstrap version of the test, the estimated limiting distribution of
Γ(ψ̂, P̂0)
is approximated by assuming that ψ̂ has a distribution equal to P̂0 and that P̂0 is normal
distribution.ld_est_meth = "perm"
): When using the permutation version
of the test, the estimated limiting distribution of Γ(ψ̂, P̂0)
is approximated by repeatedly permuting the data and recalculating ψ̂ using the permuted data. This
method may provide better finite sample performance. However, it comes
at the cost computational efficiency. Also note that depending
on the parameter of interest, the permutation based test may not have
the same null hypothesis as is desired. Thus, care must be taken when
using this method.The next two controls specify the accuracy of the approximation of the testing procedure.
To understand this control argument it is important to distinguish between our parameter estimator ψ̂ and our test statistic, which is a function of ψ̂ and the estimated limiting distribution of ψ̂ under the null hypothesis (that ψ = 0), denoted by P̂0. Letting Γ denote our performance measure, conditional on our observations, the true value of the test statistic is fixed and equal to Γ(ψ̂, P̂0).
The n_peld_mc_samples
argument determines how accurate
the approximation of test statistic Γ(ψ̂, P̂0)
will be. The performance measure is frequently a function of P̂0 through some
probability statement (see the perf_meas
for examples). To
approximate these probabilities, a MC approximation is used and
n_peld_mc_samples
determines how many MC draws are
taken.
Considering this argument in practice, note that the testing procedure only approximates the test statistic:
tc <- amp::test.control(n_peld_mc_samples = 50, pos_lp_norms = "2")
set.seed(10)
test_1 <- amp::mv_pn_test(obs_data = obs_data, param_est = amp::ic.pearson,
control = tc)
set.seed(20)
test_2 <- amp::mv_pn_test(obs_data = obs_data, param_est = amp::ic.pearson,
control = tc)
print(c(test_1$test_stat, test_2$test_stat))
#> [1] 0.72 0.84
In order to better approximate the test statistic, one may increase the value of this control argument:
mc_draws <- c(10, 50)
all_res <- list()
for (mc_draws in c(10, 50)) {
set.seed(121)
tc <- amp::test.control(n_peld_mc_samples = mc_draws, pos_lp_norms = 2,
perf_meas = "est_acc")
test_stat <- replicate(50, amp::mv_pn_test(obs_data = obs_data,
param_est = amp::ic.pearson,
control = tc)$test_stat)
all_res[[as.character(mc_draws)]] <-
data.frame("mc_draws" = mc_draws, test_stat)
}
oldpar <- par(mfrow = c(1,2))
yl <- 25
hist(all_res[[1]]$test_stat, main = "MC draws = 10",
xlab = "Test Statistic", xlim = c(0, 1), ylim = c(0, yl),
breaks = seq(0, 1, 0.1))
hist(all_res[[2]]$test_stat, main = "MC draws = 50",
xlab = "Test Statistic", xlim = c(0, 1), ylim = c(0, yl),
breaks = seq(0, 1, 0.1))
The other parameter that determines the approximation accuracy of the
testing procedure is ts_ld_bs_samp
. This argument
determines the number of draws taken from the estimated limiting
distribution of Γ(ψ̂, P̂0).
This is different that n_peld_mc_samples
that determines
the accuracy of these draws and the test statistic.
mv_pn_test
The last argument determines the output of the
mv_pn_test
function. The standard output of the test
function is a list containing the following:
pvalue
: The approximate p-value of the testtest_stat
: The approximate value of the test statistic
(Γ(ψ̂, P̂0)).test_st_eld
: The approximate limiting distribution of
the test statistic (with length equal to
ts_ld_bs_samp
).chosen_norm
: A vector indicating which norm was chosen
by the adaptive testparam_ests
: The parameter estimate (ψ̂).param_ses
: An estimate of the standard error off each
element of ψ̂oth_ic_inf
: Any other information provided by the
param_est
function when calculating the IC and parameter
estimates.other_output
is a character vector. Currently
other_output
only provides the option of returning two
additional output elements.
"var_est"
is contained in other_output
,
the test output will contain will have var_mat
returned
which is the empirical second moment of the IC (equal asymptotically to
the variance estimator). However, this matrix can be quite large for
larger dimensions, which is why there is a separate control for this
option."obs_data"
is contained in the
other_output
, the test output will return the data passed
to the testing function.