grcmle {GRCdata}R Documentation

Maximum likelihood estimation of Poisson or ZIP parameters at the aggregate level.

Description

This function infers Poisson or zero-inflated Poisson (ZIP) parameters from grouped and right-censored count data, and conducts a chi-squared goodness-of-fit test. A grouped and right-censored scheme may look like

0, 1, 2--4, 5--8, 9+.

For grouped and right-censored count data collected in a survey, such as frequency of alcohol drinking, number of births or occurrence of crimes, the response category designed as the example above means never, once, 2 to 4 times, 5 to 8 times, 9 times and more. The frequency distribution from a sample corresponding to the example above may look like

3, 15, 168, 155, 15.

Usage

grcmle(counts, scheme, method = c("Poisson", "ZIP"),
  do.plot = T, init.guess = NULL,
  optimizing.algorithm.index = 2, lambda.extend.ratio = 3,
  conf.level = 0.95)

Arguments

counts

specifies the frequency distribution of the grouped and right-censored count data. For the example above, one may input

counts = c(3, 15, 168, 155, 15).

scheme

specifies the grouping scheme. It should be a vector of integers containing the starting point (or the lowest integer) of each group. For example, to input the scheme above

0, 1, 2--4, 5--8, 9+,

one may use

scheme = c(0, 1, 2, 5, 9).

method

a string parameter specifies which statistical model to use. Currently there are two options "Poisson" and "ZIP". The default value is "Poisson". It can be abbreviated.

do.plot

a logical variable indicating whether or not to plot the log likelihood. The default is T.

init.guess

the initial value used for the optimization procedure of the likelihood estimation. The default value is NULL, which instructs the function grcmle to select the initial value automatically.

optimizing.algorithm.index

defines which optimization algorithm to use. Currently the possible values are 1,2,3,4,5,6,7 and 8, representing the following algorithms, respectively:

NLOPT_GN_DIRECT_L

NLOPT_GN_DIRECT

NLOPT_GN_DIRECT_L_RAND

NLOPT_GN_DIRECT_NOSCAL

NLOPT_GN_DIRECT_L_NOSCAL

NLOPT_GN_DIRECT_L_RAND_NOSCAL

NLOPT_GN_ORIG_DIRECT

NLOPT_GN_ORIG_DIRECT_L

For details of these algorithms, please see the manual of the R package "nloptr". The default value is 2.

lambda.extend.ratio

specifies the searching interval of possible \lambda as [0, nr], where n is the left end (i.e., the lowest integer) of the last right-censored group, and r is lambda.extend.ratio. By default, we set

lambda.extend.ratio=3.

conf.level

confidence level of the confidence interval(s) for the parameter(s) inferred

Details

Maximum likelihood estimation is used for the inference.

Value

The returned value is a list containing

mle

the parameter(s) inferred. For Poisson model, it is the estimate of \lambda. For ZIP model, it shows a vector of length 2: the first element is the estimate of p and the second element is the estimate of \lambda.

p.value

the p-value of the chi-squared test of goodness-of-fit.

df

the degree(s) of freedom of the chi-squared test of goodness-of-fit.

CI.lambda

the confidence interval of \lambda obtained by normal approximation

CI.p

the confidence interval of p obtained by normal approximation

conf.level

the confidence level

std.err

the standard error of \lambda or the standard errors of (p, \lambda), if a ZIP model is specified

Author(s)

Authors: Xin Guo <x.guo@polyu.edu.hk>, Qiang Fu <qiang.fu@ubc.ca>

Examples

grcmle(counts=c(6, 15, 168, 155, 15), scheme = c(0, 1, 2, 5, 9))

grcmle(counts=c(6, 15, 168, 155, 15), scheme = c(0, 1, 2, 5, 9), method = "ZIP")


[Package GRCdata version 1.0 Index]