Learn R Programming

zipfextR (version 1.0.2)

zipfpssFit: Zipf-PSS parameters estimation.

Description

For a given sample of strictly positive integer numbers, usually of the type of ranking data or frequencies of frequencies data, estimates the parameters of the Zipf-PSS distribution by means of the maximum likelihood method. The input data should be provided as a frequency matrix.

Usage

zipfpssFit(data, init_alpha = NULL, init_lambda = NULL, level = 0.95,
  isTruncated = FALSE, ...)

# S3 method for zipfpssR residuals(object, isTruncated = FALSE, ...)

# S3 method for zipfpssR fitted(object, isTruncated = FALSE, ...)

# S3 method for zipfpssR coef(object, ...)

# S3 method for zipfpssR plot(x, isTruncated = FALSE, ...)

# S3 method for zipfpssR print(x, ...)

# S3 method for zipfpssR summary(object, isTruncated = FALSE, ...)

# S3 method for zipfpssR logLik(object, ...)

# S3 method for zipfpssR AIC(object, ...)

# S3 method for zipfpssR BIC(object, ...)

Arguments

data

Matrix of count data in form of table of frequencies.

init_alpha

Initial value of \(\alpha\) parameter (\(\alpha > 1\)).

init_lambda

Initial value of \(\lambda\) parameter (\(\lambda > 0\)).

level

Confidence level used to calculate the confidence intervals (default 0.95).

isTruncated

Logical; if TRUE, the truncated version of the distribution is returned.(default = FALSE)

...

Further arguments to the generic functions. The extra arguments are passing to the optim function.

object

An object from class "zpssR" (output of zipfpssFit function).

x

An object from class "zpssR" (output of zipfpssFit function).

Value

Returns a zpssR object composed by the maximum likelihood parameter estimations jointly with their standard deviation and confidence intervals and the value of the log-likelihood at the maximum likelihood estimator.

Details

The argument data is a two column matrix with the first column containing the observations and the second column containing their frequencies.

The log-likelihood function is equal to: $$l(\alpha, \lambda, x) = \sum_{i =1} ^{m} f_a(x_i)\, log(P(Y = x_i)),$$ where \(m\) is the number of different values in the sample, being \(f_{a}(x_i)\) is the absolute frequency of \(x_i\).The probabilities are calculated applying the Panjer recursion. By default the initial values of the parameters are computed using the function getInitialValues. The function optim is used to estimate the parameters.

References

Panjer, H. H. (1981). Recursive evaluation of a family of compound distributions. ASTIN Bulletin: The Journal of the IAA, 12(1), 22-26.

Sundt, B., & Jewell, W. S. (1981). Further results on recursive evaluation of compound distributions. ASTIN Bulletin: The Journal of the IAA, 12(1), 27-39.

See Also

getInitialValues.

Examples

Run this code
# NOT RUN {
data <- rzipfpss(100, 2.5, 1.3)
data <- as.data.frame(table(data))
data[,1] <- as.numeric(as.character(data[,1]))
data[,2] <- as.numeric(as.character(data[,2]))
initValues <- getInitialValues(data, model='zipfpss')
obj <- zipfpssFit(data, init_alpha = initValues$init_alpha, init_lambda = initValues$init_lambda)
# }

Run the code above in your browser using DataLab