tnl.test: Non-parametric tests for the two-sample problem based on...

Description Usage Arguments Details Value References Examples

View source: R/tnlTEST.R

Description

tnl.test performs a nonparametric test for two sample test on vectors of data.

ptnl gives the distribution function of Tn(ℓ) against the specified quantiles.

dtnl gives the density of Tn(ℓ) against the specified quantiles.

qtnl gives the quantile function of Tn(ℓ) against the specified probabilities.

rtnl generates random values from Tn(ℓ).

tnl_mean gives an expression for E(Tn(ℓ)) under H0:F=G.

ptnl.lehmann gives the distribution function of Tn(ℓ) under Lehmann alternatives.

dtnl.lehmann gives the density of Tn(ℓ) under Lehmann alternatives.

qtnl.lehmann gives the quantile function of Tn(ℓ) against the specified probabilities under Lehmann alternatives.

rtnl.lehmann generates random values from Tn(ℓ) under Lehmann alternatives.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
tnl.test(x, y, l, exact = "NULL")

ptnl(q, n, l, exact = "NULL", trial = 1e+05)

dtnl(k, n, l, exact = "NULL", trial = 1e+05)

qtnl(p, n, l, exact = "NULL", trial = 1e+05)

rtnl(N, n, l)

tnl_mean(n, l)

ptnl.lehmann(q, n, l, gamma)

dtnl.lehmann(k, n, l, gamma)

qtnl.lehmann(p, n, l, gamma)

rtnl.lehmann(N, n, l, gamma)

Arguments

x

the first (non-empty) numeric vector of data values.

y

the second (non-empty) numeric vector of data values.

l

class parameter of Tn(ℓ).

exact

the method that will be used. "NULL" or a logical indicating whether an exact should be computed. See ‘Details’ for the meaning of NULL.

n

sample size.

trial

number of trials for simulation.

k, q

vector of quantiles.

p

vector of probabilities.

N

number of observations. If length(N) > 1, the length is taken to be the number required.

gamma

parameter of Lehmann alternative.

Details

A non-parametric two-sample test is performed for testing null hypothesis H0:F=G against the alternative hypothesis H1:F ≠ G. The assumptions of the Tn(ℓ) test are that both samples should come from a continuous distribution and the samples should have the same sample size.
Missing values are silently omitted from x and y.
Exact and simulated p-values are available for the Tn(ℓ) test. If exact ="NULL" (the default) the p-value is computed based on exact distribution when the sample size is less than 11. Otherwise, p-value is computed based on a Monte Carlo simulation. If exact ="TRUE", an exact p-value is computed. If exact="FALSE" , a Monte Carlo simulation is performed to compute the p-value. It is recommended to calculate the p-value by a Monte Carlo simulation (use exact="FALSE"), as it takes too long to calculate the exact p-value when the sample size is greater than 10.
The probability mass function (pmf), cumulative density function (cdf) and quantile function of Tn(ℓ) are also available in this package, and the above-mentioned conditions about exact ="NULL", exact ="TRUE" and exact="FALSE" is also valid for these functions.
Exact distribution of Tn(ℓ) test is also computed under Lehman alternative.
Random number generator of Tn(ℓ) test statistic are provided under null hypothesis in the library.

Value

tnl.test returns a list with the following components

statistic:

the value of the test statistic.

p.value:

the p-value of the test.

ptnl returns a list with the following components

method:

The method that was used (exact or simulation). See ‘Details’.

cdf:

distribution function of Tn(ℓ) against the specified quantiles.

dtnl returns a list with the following components

method:

The method that was used (exact or simulation). See ‘Details’.

pmf:

density of Tn(ℓ) against the specified quantiles.

qtnl returns a list with the following components

method:

The method that was used (exact or simulation). See ‘Details’.

quantile:

quantile function against the specified probabilities.

rtnl return N of the generated random values.

tnl_mean return the mean of Tn(ℓ).

ptnl.lehmann return vector of the distribution under Lehmann alternatives against the specified gamma.

dtnl.lehmann return vector of the density under Lehmann alternatives against the specified gamma.

qtnl.lehmann returns a quantile function against the specified probabilities under Lehmann alternatives.

rtnl.lehmann return N of the generated random values under Lehmann alternatives.

References

Karakaya K. et al. (2021). A Class of Non-parametric Tests for the Two-Sample Problem based on Order Statistics and Power Comparisons . Submitted paper.
Aliev F. et al. (2021). A Nonparametric Test for the Two-Sample Problem based on Order Statistics. Submitted paper.

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
require(stats)
x <- rnorm(7, 2, 0.5)
y <- rnorm(7, 0, 1)
tnl.test(x, y, l = 2)
# $statistic
# [1] 2
#
# $p.value
# [1] 0.02447552
##############
ptnl(q = 2, n = 6, l = 2, trial = 100000)
# $method
# [1] "exact"
#
# $cdf
# [1] 0.03030303
##############
dtnl(k = 3, n = 7, l = 2)
# $method
# [1] "exact"
#
# $pmf
# [1] 0.05710956
## Not run: 
qtnl(p = .3, n = 4, l = 1, exact = "FALSE")
# $method
# [1] "Monte Carlo simulation"
#
# $quantile
# [1] 2

## End(Not run)
##############
rtnl(N = 15, n = 7, l = 2)
# [1] 7 5 5 6 7 5 4 7 7 6 7 3 6 3 5
##############
require(base)
tnl_mean(n = 11, l = 2)
# [1] 8.058115
##############
ptnl.lehmann(q = 3, n = 5, l = 2, gamma = 1.2)
# [1] 0.1529147
##############
dtnl.lehmann(k = 3, n = 6, l = 2, gamma = 0.8)
# [1] 0.08230829
qtnl.lehmann(p = .3, n = 4, l = 1, gamma = 0.5)
# [1] 2
##############
rtnl.lehmann(N = 15, n = 7, l = 2, gamma = 0.5)
# [1] 7 6 7 7 7 6 7 5 3 7 5 3 5 4 7

ihababusaif/tnlTEST documentation built on Dec. 20, 2021, 6:55 p.m.