Description Usage Arguments Value Examples
mmfit function can estimate the parameters of following distributions, including Poisson, power law, gamma, beta, mixture of 2 Poissons, and mixture of 2 Exponentials. We also do calculation for CDFband in this function For powerlaw distribution, simply keep summing k^(-gamma), k = 1,2,3,... until the sum doesn't change much, and then take c to be the reciprocal of the sum.
1 |
x |
a set of sample data |
g |
moment function |
start |
initial values to start with |
type |
distribution type. It take a value from "Poisson", "power law", "Gamma", "Beta", mixture of "2Poissons", and "2Exponential". |
an s3 class object including the estimated distribution parameters, standard error, fitting curves, and empirical CDF with K-S confidence band
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 30 31 32 33 34 35 36 37 38 39 40 | ## Not run:
#############################################
#Beta test
n = 1000
x <- rbeta(n, 0.5, 0.5)
summary.mmfit(x, g, c(0.1, 0.1), "Beta")
plot.mmfit(x, g, c(0.1, 0.1), "Beta")
#############################################
#Poisson test
n = 1000
x <- rpois(n, 4)
summary.mmfit(x, g, 1, "Poisson")
plot.mmfit(x, g, 1, "Poisson")
#############################################
# Gamma test
n = 1000
x <- rgamma(n, 9, rate = 2)
summary.mmfit(x, g, c(5, 5), "Gamma")
plot.mmfit(x, g, c(5, 5), "Gamma")
#############################################
# 2Poisson test
n = 10000
x <- ifelse(runif(n) < 0.3, rpois(n, 4), rpois(n, 5))
summary.mmfit(x, g, c(3, 3, 0.1), "2Poisson")
plot.mmfit(x, g, c(3, 3, 0.1), "2Poisson")
#############################################
# 2Exponential test
n = 1000
x <- ifelse(runif(n) < 0.2, rexp(n, 0.3), rexp(n, 0.9))
summary.mmfit(x, g, c(0.1, 0.1, 0.1), "2Exponential")
plot.mmfit(x, g, c(0.2, 0.2, 0.2), "2Exponential")
#############################################
# powerlaw test
n = 1000
x = poweRlaw::rpldis(n, 1, 2)
summary.mmfit(x, g, 1.9, "powerlaw")
plot.mmfit(x, g, 1.9, "powerlaw")
#############################################
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.