zipfpeFit: Zipf-PE parameters estimation.

Description Usage Arguments Details Value See Also Examples

View source: R/zipfpeFit.R

Description

For a given sample of strictly positive integer values, usually of the type of ranking data or frequencies of frequencies data, estimates the parameters of the Zipf-PE 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
zipfpeFit(data, init_alpha = NULL, init_beta = NULL, level = 0.95,
  ...)

## S3 method for class 'zipfpeR'
residuals(object, ...)

## S3 method for class 'zipfpeR'
fitted(object, ...)

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

## S3 method for class 'zipfpeR'
plot(x, ...)

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

## S3 method for class 'zipfpeR'
summary(object, ...)

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

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

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

Arguments

data

Matrix of count data in form of table of frequencies.

init_alpha

Initial value of α parameter (α > 1).

init_beta

Initial value of β parameter (β \in (-∞, +∞)).

level

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

...

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

object

An object from class "zpeR" (output of zipfpeFit function).

x

An object from class "zpeR" (output of zipfpeFit 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) = β\, (N - ζ(α)^{-1}\, ∑_{i = 1} ^m f_{a}(x_{i})\, ζ(α, x_i)) + ∑_{i = 1} ^m f_{a}(x_{i})\, log ≤ft( \frac{e^{\frac{β\, x_{i}^{-α}}{ζ(α)}} - 1}{e^{β} - 1} \right),

where f_{a}(x_i) is the absolute frequency of x_i, m is the number of different values in the sample and N is the sample size, i.e. N = ∑_{i = 1} ^m x_i f_a(x_i).

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 an object composed by the maximum likelihood parameter estimations jointly with their standard deviation and confidence intervals. It also contains the value of the log-likelihood at the maximum likelihood estimator.

See Also

getInitialValues.

Examples

1
2
3
4
5
6
data <- rzipfpe(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='zipfpe')
obj <- zipfpeFit(data, init_alpha = initValues$init_alpha, init_beta = initValues$init_beta)

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