Density, distribution function, quantile function and random generation for Haight's zeta distribution with parameter shape.

dhzeta(x, shape, log = FALSE)
phzeta(q, shape, log.p = FALSE)
qhzeta(p, shape)
rhzeta(n, shape)

Arguments

x, q, p, n

Same meaning as runif.

shape

The positive shape parameter. Called \(\alpha\) below.

log,log.p

Same meaning as in pnorm or qnorm.

Details

The probability function is $$f(x) = (2x-1)^{(-\alpha)} - (2x+1)^{(-\alpha)},$$ where \(\alpha>0\) and \(x=1,2,\ldots\).

Value

dhzeta gives the density, phzeta gives the distribution function, qhzeta gives the quantile function, and rhzeta generates random deviates.

Author

T. W. Yee and Kai Huang

Note

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

See also

Examples

dhzeta(1:20, 2.1)
#>  [1] 9.004491e-01 6.549734e-02 1.725418e-02 6.889024e-03 3.407965e-03
#>  [6] 1.923970e-03 1.188388e-03 7.835704e-04 5.429356e-04 3.911642e-04
#> [11] 2.908317e-04 2.219182e-04 1.730589e-04 1.374781e-04 1.109676e-04
#> [16] 9.082036e-05 7.524208e-05 6.301177e-05 5.327917e-05 4.544002e-05
rhzeta(20, 2.1)
#>  [1] 1 1 1 1 3 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1

round(1000 * dhzeta(1:8, 2))
#> [1] 889  71  20   8   4   2   1   1
table(rhzeta(1000, 2))
#> 
#>   1   2   3   4   5   6   7   8  11  12  13  28 
#> 900  61  18   9   1   2   3   1   1   2   1   1 

if (FALSE)  shape <- 1.1; x <- 1:10
plot(x, dhzeta(x, shape = shape), type = "h", ylim = 0:1,
     sub = paste("shape =", shape), las = 1, col = "blue",
     ylab = "Probability", lwd = 2,
     main = "Haight's zeta: blue = density; 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, phzeta(x, shape = shape), col = "orange", lty = 3, lwd = 2,
      type = "h")
#> Error: object 'shape' not found
 # \dontrun{}