pDtrend: Cumulative distribution function of nonparametric trend...

View source: R/trend.R

pDtrendR Documentation

Cumulative distribution function of nonparametric trend statistic D

Description

This function computes \Pr(D \le k) (\Pr(D \ge k)), i.e. lower (upper) cumulative probabilities for D=\sum_{i=1}^{n} (R_i - i)^2, the nonparametric trend statistic proposed by \insertCiteLehmann75;textualskedastic, under the assumption that the ranks R_i are computed on a series of n independent and identically distributed random variables with no ties. The function may be used to compute one-sided p-values for the nonparametric test for heteroskedasticity of \insertCiteHorn81;textualskedastic. Computation time is extremely slow for n > 10 if usedata is set to FALSE; thus a normal approximation is implemented, including a continuity correction.

Usage

pDtrend(
  k,
  n,
  lower.tail = TRUE,
  exact = (n <= 10),
  tiefreq = NA,
  override = FALSE
)

Arguments

k

An integer of length \ge 1 or a character "all" indicating that the cumulative distribution function should be applied to the entire support of D. The latter is only acceptable when exact is TRUE, since the distribution is otherwise continuous.

n

A positive integer representing the number of observations in the series.

lower.tail

A logical. Should lower tailed cumulative probability be calculated? Defaults to TRUE. Note that both lower- and upper- tailed cumulative probabilities are computed inclusive of k.

exact

A logical. Should exact distribution of D be used by calling dDtrend? If FALSE, a normal approximation is used. If tiefreq is not NA (ties are present), normal approximation is used regardless of the value of exact. By default, exact is set to TRUE provided that n <= 10. Setting exact to TRUE for n > 11 results in an error unless override is set to TRUE.

tiefreq

A double vector corresponding to the value of d_i in \insertCiteLehmann75;textualskedastic. These are the frequencies of the various tied ranks. If ties are absent, NA (the default).

override

A logical. By default, the dDtrend function aborts if n > 11 due to the prohibitively slow computation (which may cause some systems to crash). Setting this argument to TRUE overrides the abort. Ignored unless exact is TRUE.

Value

A double between 0 and 1 representing the probability/ies of D taking on at least (at most) the value(s) in the names attribute.

References

\insertAllCited

See Also

dDtrend, horn

Examples

# For an independent sample of size 6, the probability that D is <= 50 is
# 0.8222
pDtrend(k = 50, n = 6)
# Normal approximation of the above with continuity correction is
# 0.8145
pDtrend(k = 50, n = 6, exact = FALSE)


skedastic documentation built on May 29, 2024, 12:20 p.m.