Learn R Programming

zipfextR (version 1.0.2)

zipfpssMoments: Distribution Moments.

Description

General function to compute the k-th moment of the Zipf-PSS distribution for any integer value \(k \geq 1\), when it exists. The k-th moment exists if and only if \(\alpha > k + 1\).

Usage

zipfpssMoments(k, alpha, lambda, isTruncated = FALSE,
  tolerance = 10^(-4))

Arguments

k

Order of the moment to compute.

alpha

Value of the \(\alpha\) parameter (\(\alpha > k + 1\)).

lambda

Value of the \(\lambda\) parameter (\(\lambda > 0\)).

isTruncated

Logical; if TRUE, the truncated version of the distribution is returned.

tolerance

Tolerance used in the calculations (default = \(10^{-4}\)).

Value

A positive real value corresponding to the k-th moment of the distribution.

Details

The k-th moment of the Zipf-PSS distribution is finite for \(\alpha\) values strictly greater than \(k + 1\). It is computed by calculating the partial sums of the serie, and stopping when two consecutive partial sums differ less than the tolerance value. The value of the last partial sum is returned.

Examples

Run this code
# NOT RUN {
zipfpssMoments(1, 2.5, 2.3)
zipfpssMoments(1, 2.5, 2.3, TRUE)
# }

Run the code above in your browser using DataLab