zipfpssFit: Zipf-PSS parameters estimation.

Description Usage Arguments Details Value References See Also Examples

View source: R/zipfpssFit.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
zipfpssFit(data, init_alpha = NULL, init_lambda = NULL, level = 0.95,
  isTruncated = FALSE, ...)

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

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

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

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

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

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

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

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

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

Arguments

data

Matrix of count data in form of table of frequencies.

init_alpha

Initial value of α parameter (α > 1).

init_lambda

Initial value of λ parameter (λ > 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).

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(α, λ, x) = ∑_{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.

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.

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

1
2
3
4
5
6
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)

zipfextR documentation built on July 8, 2020, 6:23 p.m.