Learn R Programming

bayescount (version 0.9.9-1)

maximise.likelihood: Calculate the Maximum Likelihood Parameters of a Continuous or Count Distribution

Description

Crude function to maximise the likelihood of one of the following distributions: Poisson (P), gamma (G), lognormal (L), Weibull (W), gamma Poisson (GP), lognormal Poisson (LP), Weibull Poisson (WP), all with or without zero-inflation (ZI). Uses the likelihood() function to calculate the likelihood at each iteration. For mixture models, the likelihood is calculated for the data by integrating over each possible value of lambda for each data point, which may take some time for large datasets. Starting values for each parameter are optional, but may improve the speed and reliability of the function if appropriate values are provided. If missing, starting values will be calculated from the data. This function is provided for interest only, and is vastly inferior as a data analysis tool to the Bayesian MCMC methods used by bayescount(). *THIS SOFTWARE IS INTENDED FOR EDUCATIONAL PURPOSES ONLY AND SHOULD NOT BE RELIED UPON FOR REAL WORLD APPLICATIONS*

Usage

maximise.likelihood(data=stop("Data must be specified"), model=stop("Please specify a distribution"), mean=NA, variance=NA, 
   zi=NA, shape=NA, scale=NA, silent=FALSE)

Arguments

Value

The values for each parameter at the maximum likelihood are output. No standard error is given (Bayesian MCMC using bayescount() gives a much better analysis)

See Also

bayescount, bayescount.single, likelihood

Examples

Run this code
# obtain values for mean and zero-inflation of a zero-inflated gamma Poisson model:

data <- rpois(100, rgamma(100, shape=1, scale=8))
data[1:15] <- 0

maximise.likelihood(data, "ZIGP")

Run the code above in your browser using DataLab