zipfpeFit {zipfextR} | R Documentation |
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 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 |
init_beta |
Initial value of |
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(\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.
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
Examples
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)