KhmaladzeTrans: Implementing Khmaladze Martingale Transformation.

Description Usage Arguments Value References Examples

View source: R/KmtFunc.R

Description

Performs goodness-of-fit test through Khmaladze matringale transformation

Usage

1
KhmaladzeTrans(X, Modified = FALSE, strDist, bGraph = FALSE, nNum = 10)

Arguments

X

a random sample of n observations

Modified

a logical value which specifies whether or not to use the modeifed version of the test: False calls the original version while True calls the modified version.

strDist

the name of the null distribution for the hypothesis test: Normal, Cauchy, or Logistic. Other distributions such as Gumbel, Weibull and Frechet will be available in later versions.

bGraph

a logical value which specifies whether or not to get the graph of the objective function of the martingale transformation.

nNum

the number of ticks on each segmented interval when drawing the graph of the objective function. The default is 10. Bigger value will result in a smoother graph.

Value

A list of the following values:

opt.x
  • When Modified is False, opt.x is the value of x where the optimum of the objective function - which is also the test statistic - occurs.

  • When Modified is True, opt.x is the vector of the value of x's where the infimum and supremum of U_{n} occur.

test.stat
  • When Modified is False, test.stat is the test statistic obtained through Khmaladze martingale transformation.

  • When Modified is True, test.stat is the vector of the supremum of U_{n}, the infimum of U_{n}, and the difference of them.

graph.data

a data frame which includes the information of the objective function.

graph

a ggplot object which includes the graph of the objective function.

intervals

a list of segmented intervals over which the graph of the objective function is defined.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
####################
n = 10
X = rnorm(n, 1,3)    # Generate a random sample of n observations from N(1,3)
strDist = "Normal"
Modified=FALSE
lResult = KhmaladzeTrans(X, Modified, strDist, bGraph=TRUE, nNum=10)
KMT_OptimalX = lResult$opt.x
KMT_TestStat = lResult$test.stat
KMT_DM = lResult$graph.data
KMT_Graph = lResult$graph

#### Draw the graph of the objective function
KMT_Graph

KMT_Intervals = lResult$intervals
KMT_Muhat = lResult$mu
KMT_Sigmahat = lResult$sigma


#####################

#####################
n = 10
X = rlogis(n, 1,2)  # Generate a random sample of n observations from the logistic distribution
strDist = "Logistic"
Modified=TRUE
lResult = KhmaladzeTrans(X, Modified, strDist, bGraph=TRUE, nNum=10)
KMT_Optimal_Positive_X = lResult$opt.x[1]
KMT_Optimal_Negative_X = lResult$opt.x[2]
KMT_Postive_TestStat = lResult$test.stat[1]
KMT_Negative_TestStat = lResult$test.stat[2]
KMT_TestStat = lResult$test.stat[3]
KMT_DM = lResult$graph.data
KMT_Graph = lResult$graph

#### Draw the graph of the objective function
KMT_Graph

KMT_Intervals = lResult$intervals
KMT_Muhat = lResult$mu
KMT_Sigmahat = lResult$sigma
#####################





#####################
n = 10
X = rcauchy(n, 0,1)  # Generate a random sample of n observations from Cauchy distribution
strDist = "Cauchy"
Modified=FALSE
lResult = KhmaladzeTrans(X, Modified, strDist, bGraph=TRUE, nNum=10)
KMT_OptimalX = lResult$opt.x
KMT_TestStat = lResult$test.stat
KMT_DM = lResult$graph.data
KMT_Graph = lResult$graph

#### Draw the graph of the objective function
KMT_Graph


KMT_Intervals = lResult$intervals
KMT_Muhat = lResult$mu
KMT_Sigmahat = lResult$sigma
#####################

GofKmt documentation built on Oct. 24, 2020, 1:07 a.m.