Type: Package
Title: Khmaladze Martingale Transformation Goodness-of-Fit Test
Version: 2.3.1
Description: Consider a goodness-of-fit (GOF) problem of testing whether a random sample comes from one sample location-scale model where location and scale parameters are unknown. It is well known that Khmaladze martingale transformation method proposed by Khmaladze (1981) <doi:10.1137/1126027> provides asymptotic distribution free test for the GOF problem. This package provides test statistic and critical value of GOF test for normal, Cauchy, and logistic distributions. This package used the main algorithm proposed by Kim (2020) <doi:10.1007/s00180-020-00971-7> and tests for other distributions will be available at the later version.
License: GPL-2
Encoding: UTF-8
Depends: R (≥ 2.10)
Imports: Rcpp (≥ 1.0.10), ggplot2, stats, utils, Rsolnp
LinkingTo: Rcpp, RcppArmadillo
RoxygenNote: 7.3.2
NeedsCompilation: yes
Packaged: 2025-12-18 22:25:22 UTC; ji_wo
Author: Jiwoong Kim [aut, cre]
Maintainer: Jiwoong Kim <jwboys26@gmail.com>
Repository: CRAN
Date/Publication: 2025-12-18 22:40:02 UTC

Implementing Khmaladze Martingale Transformation.

Description

Performs goodness-of-fit test through Khmaladze matringale transformation

Usage

Run_KMT(
  X,
  strDistr = "Normal",
  bEstimation = FALSE,
  bFast_Estimation = FALSE,
  bParallel = FALSE,
  nThreads = 16
)

Arguments

X

a random sample of n observations

strDistr

a null distribution for the hypothesis test: Normal, Cauchy, Logistic, or Gumbel.

bEstimation

a logical value which specifies whether or not to estimate parameters. The default value is TRUE. For FALSE, (\mu) and (\sigma) will be set as 0 and 1, respectively.

bFast_Estimation

a logical value which specifies whether or not to use the maximum likelihood estimator (\hat{\theta}) for the location and scale parameters The default value is FALSE.

bParallel

a logical value which specifies whether or not to use the parallel computing. The default value is FALSE.

nThreads

the number of threads when bParallel is TRUE. The default value is 16.

Value

A list of the following values:

opt_x

opt.x is the value of x where the optimum of the objective function - which is also the test statistic - occurs.

test_stat

test.stat is the test statistic obtained through Khmaladze martingale transformation.

mu

the point estimate for the location parameter mu

sigma

the point estimate for the scale parameter sigma

References

[1] Khmaladze, E.V., Koul, H.L. (2004). Martingale transforms goodness-of-fit tests in regression models. Ann. Statist., 32. 995-1034

[2] E.V. Khmaladze, H.L. Koul (2009). Goodness-of-fit problem for errors in nonparametric regression: distribution free approach. Ann. Statist., 37(6A) 3165-3185.

[3] Kim, Jiwoong (2020). Implementation of a goodness-of-fit test through Khmaladze martingale transformation. Comp. Stat., 35(4): 1993-2017

Examples

####################
n=20
mu0=2; sigma0=1
X = rnorm(n, mu0, sigma0)


Run_KMT(X, strDistr="Normal")