Skip to contents

For the density function of the Logarithmic series distribution see Logarithmic series. For an example data set, see corbet.

Usage

mllgser(x, na.rm = FALSE, ...)

Arguments

x

a (non-empty) numeric vector of data values.

na.rm

logical. Should missing values be removed?

...

Not in use.

Value

mllgser returns an object of class univariateML. This is a named numeric vector with maximum likelihood estimates for theta.

model

The name of the model.

density

The density associated with the estimates.

logLik

The loglikelihood at the maximum.

support

The support of the density.

n

The number of observations.

call

The call as captured my match.call

References

Fisher, R. A., Corbet, A. S., & Williams, C. B. (1943). The relation between the number of species and the number of individuals in a random sample of an animal population. The Journal of Animal Ecology, 12(1), 42. https://doi.org/10.2307/1411

Johnson, N. L., Kemp, A. W., & Kotz, S. (2005). Univariate Discrete Distributions (3rd ed.). Wiley-Blackwell.

See also

Logarithmic series for the density.

Examples

theta_hat <- mllgser(corbet)

# The corbert data contains observations from 1 to 24.
observed <- table(corbet)

# The chi square test evaluated at the maximum likelihood is highly significant.
expected <- extraDistr::dlgser(1:24, theta_hat)
chisq.test(observed, p = expected / sum(expected))
#> Warning: Chi-squared approximation may be incorrect
#> 
#> 	Chi-squared test for given probabilities
#> 
#> data:  observed
#> X-squared = 94.357, df = 23, p-value = 1.305e-10
#> 

# But chi square test evaluated at 0.997 (used in Corbet) is not.
expected <- extraDistr::dlgser(1:24, 0.997)
chisq.test(observed, p = expected / sum(expected))
#> 
#> 	Chi-squared test for given probabilities
#> 
#> data:  observed
#> X-squared = 22.925, df = 23, p-value = 0.4651
#> 

# The chi square for `dzipf` is similar.
expected <- sads::dzipf(1:24, mlzipf(corbet)[1], mlzipf(corbet)[2]) * length(corbet)
chisq.test(observed, p = expected / sum(expected))
#> 
#> 	Chi-squared test for given probabilities
#> 
#> data:  observed
#> X-squared = 18.99, df = 23, p-value = 0.7018
#>