Learn R Programming

zipfextR (version 1.0.2)

zipfpeFit: Zipf-PE parameters estimation.

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

zipfpeFit(data, init_alpha = NULL, init_beta = NULL, level = 0.95,
  ...)

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

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

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

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

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

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

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

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

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

Arguments

data

Matrix of count data in form of table of frequencies.

init_alpha

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

init_beta

Initial value of \(\beta\) parameter (\(\beta \in (-\infty, +\infty)\)).

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).

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.

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, \beta; x) = \beta\, (N - \zeta(\alpha)^{-1}\, \sum_{i = 1} ^m f_{a}(x_{i})\, \zeta(\alpha, x_i)) + \sum_{i = 1} ^m f_{a}(x_{i})\, log \left( \frac{e^{\frac{\beta\, x_{i}^{-\alpha}}{\zeta(\alpha)}} - 1}{e^{\beta} - 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 = \sum_{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.

See Also

getInitialValues.

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab