Density, distribution function, quantile function, and random generation for the differenced zeta distribution.

ddiffzeta(x, shape, start = 1, log = FALSE)
pdiffzeta(q, shape, start = 1, lower.tail = TRUE)
qdiffzeta(p, shape, start = 1)
rdiffzeta(n, shape, start = 1)

Arguments

x, q, p, n

Same as in runif.

shape, start

Details at diffzeta.

log, lower.tail

Same as in runif.

Details

This distribution appears to work well on the distribution of English words in such texts. Some more details are given in diffzeta.

Value

ddiffzeta gives the density, pdiffzeta gives the distribution function, qdiffzeta gives the quantile function, and rdiffzeta generates random deviates.

Author

T. W. Yee

Note

Given some response data, the VGAM family function diffzeta estimates the parameter shape.

Function pdiffzeta() suffers from the problems that plog sometimes has, i.e., when p is very close to 1.

See also

diffzeta, zetaff, zipf, Oizeta.

Examples

ddiffzeta(1:20, 0.5, start = 2)
#>  [1] 0.000000000 0.183503419 0.109389800 0.074651249 0.055105263 0.042827785
#>  [7] 0.034522484 0.028595479 0.024190925 0.020812163 0.018153142 0.016016020
#> [13] 0.014267797 0.012816101 0.011594981 0.010556220 0.009663837 0.008890491
#> [19] 0.008215076 0.007621066
rdiffzeta(20, 0.5)
#>  [1]    1   11    3   12    3   72 1352    1    2    4    1    1    1   13    1
#> [16]    4    4    1    2    2

if (FALSE)  shape <- 0.8; x <- 1:10
plot(x, ddiffzeta(x, sh = shape), type = "h", ylim = 0:1, las = 1,
     sub = "shape=0.8", col = "blue", ylab = "Probability",
     main = "Differenced zeta distribution: blue=PMF; orange=CDF")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'y' in selecting a method for function 'plot': object 'shape' not found
lines(x + 0.1, pdiffzeta(x, shape = shape), col = "orange",
      lty = 3, type = "h")  # \dontrun{}
#> Error: object 'shape' not found