| perform_GoF_test {BootstrapTests} | R Documentation |
Perform a univariate goodness-of-fit (GoF) hypothesis test via bootstrap resampling
Description
This function performs a bootstrap goodness-of-fit hypothesis test for a
specific univariate parametric family. The null hypothesis corresponds to the
sample coming from the specified parametric family, while the alternative
hypothesis corresponds to the sample not coming from the specified
parametric family. This function implements a parametric bootstrap and
a non-parametric bootstrap. The test statistic is the Kolmogorov-Smirnov test
statistic. To estimate the parameters of the parametric family, either a minimum
distance estimator, or a MLE estimator (the sample mean and variance)
is used. On the bootstrap sample, we have also implemented a centered MD estimator,
as in the paper. For now, only a test of normality is implemented. This function
gives the corresponding p-values, the true test statistic and the
bootstrap-version test statistics. The default (and valid) method implemented
in this function is the parametric bootstrap, together with the equivalent test statistic
and the MLE parameter estimator. Via the bootstrapOptions
argument, the user can specify other bootstrap resampling schemes,
test statistics, and parameter estimators.
Usage
perform_GoF_test(
X_data,
parametric_fam = "normal",
nBootstrap = 100,
mygrid = NULL,
show_progress = TRUE,
bootstrapOptions = NULL,
verbose = 0
)
Arguments
X_data |
numerical input vector. Perform a GoF test whether or not this
sample comes from |
parametric_fam |
name of the parametric family. For the moment, only
|
nBootstrap |
numeric value of the number of bootstrap resamples. Defaults to 100. |
mygrid |
description of the grid used to compute the CDFs on. This must be one of
|
show_progress |
logical value indicating whether to show a progress bar |
bootstrapOptions |
This can be one of
A warning is raised if the given combination of |
verbose |
If |
Value
A class object with components
-
pvals_dfa dataframe of p-values and bootstrapped test statistics:These are the p-values for the combinations of bootstrap resampling schemes, test statistics (centered and equivalent), and different parameter estimators.
It also contains the vectors of bootstrap test statistics for each of these combinations.
-
true_stata named vector of size 2 containing the true test statistics. The first entry is the Kolmogorov-Smirnov test statistic for the Minimum Distance estimator, and the second entry is the Kolmogorov-Smirnov test statistic for the MLE parameter estimator. -
nBootstrapnumber of bootstrap repetitions. -
nameMethodstring for the name of the method used.
References
Derumigny, A., Galanis, M., Schipper, W., & van der Vaart, A. (2025). Bootstrapping not under the null? ArXiv preprint, doi:10.48550/arXiv.2512.10546
See Also
perform_regression_test,perform_independence_test.
The print and plot methods, such as plot.bootstrapTest.
Examples
n <- 100
# Under H1
X_data <- rgamma(n,2,3)
result <- perform_GoF_test(X_data,
nBootstrap = 100,
bootstrapOptions = list(type_boot = "param",
type_stat = "eq",
type_estimator_bootstrap = "MLE")
)
print(result)
plot(result)
# Under H0
X_data <- rnorm(n)
result <- perform_GoF_test(X_data, nBootstrap = 100)
print(result)
plot(result)