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

Description Usage Arguments Value See Also Examples

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 FUNCTION IS DEPRECATED AND WILL BE REMOVED FROM BAYESCOUNT VERSION 1 - SEE ?count.analysis FOR AN ALTERNATIVE USING MCMC*

Usage

1
2
3
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

data

a vector of data to fit the distribution to. Count data for the count models, continuous data for the continuous distributions.

model

the distribution to fit to the data. Choices are: "P", "ZIP", "G", "ZIG", "L", "ZIL", "W", "ZIW", "GP", "ZIGP", "LP", "ZILP", "WP", "ZIWP" (case insensitive). No default.

mean

the starting value for mean. Optional.

variance

the starting value for variance. Optional.

zi

the starting value for zero-inflation. Optional.

shape

the starting value for the shape parameter. Optional.

scale

the starting value for the scale parameter. Optional.

silent

should warning messages and progress indicators be supressed? Default FALSE.

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

count.analysis

Examples

1
2
3
4
5
6
7
# 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")

mdenwood/bayescount documentation built on Oct. 17, 2019, 6:59 a.m.