Learn R Programming

touchard (version 2.0.1)

toufit: Touchard Estimation

Description

Maximum-likelihood and method-of-moments estimation of the Touchard model.

Usage

toufit(x, freq = NULL, start, method = c("ml", "mm", "gmm"), 
    rc = FALSE, trunc.at.zero = FALSE)

Arguments

x

either an object of class table with the observed counts as classifying factors or the observed counts (raw data) or the unique values of the observed counts in which case the observed frequencies must be given in argument freq; see example below for the three formats.

freq

unnecessary (and ignored) if x is a table or the raw data; must be provided if x is the unique values of the observed counts, in the same order.

start

starting values to be used by optimization/nonlinear solving algorithms. If missing, the default value is explained in the reference below.

method

one of 'ml' (maximum likelihood), 'mm' (method of moments based on the usual first and second moment conditions) or 'gmm' (generalized method of moments based on the first two moments and an extra condition on the first moment of log(Y+1).

rc

TRUE for right-censored data. Not implemented for methods 'mm' and 'gmm'.

trunc.at.zero

TRUE for model truncated at zero. Not implemented for methods 'mm' and 'gmm'.

Value

A list with the following:

fit

a list with point estimates, standard errors and variance matrix of estimates

aic

Akaike's information criterion, -2*log-likelihood + 2*p

bic

Schwarz's Bayesian criterion, -2*log-likelihood + log(n)*p

test

a data frame with likelihood ratio and Wald test results for the Null: delta = 0 (Poisson)

method

estimation method used ('ml', 'mm' or 'gmm')

data

a list with elements x and freq

Details

For method 'ml' the Touchard likelihood is numerically maximized via optim() with 'method=L-BFGS-B'. For methods 'mm' and 'gmm', the system of moment conditions is solved by calling nleqslv and numDeriv.

References

Matsushita RY, Pianto D, Andrade BB, Cancado A, Silva S (2018) The Touchard distribution, Communications in Statistics - Theory and Methods, <doi:10.1080/03610926.2018.1444177>

Andrade, BB; Matsushita, RY; Oliveira, SB (submitted) Analyzing Count Data with the Touchard Model. available upon request.

See Also

optim , rgram , Touchard , touplot

Examples

Run this code
# NOT RUN {
data(Epilepsy)
# 'seizures' is vector of raw data (351 counts) 
toufit( x = seizures, method = 'ml' )
toufit( x = seizures, method = 'mm' )
toufit( x = seizures, method = 'gmm' )

# suppose data were recorded as table object
TAB <- table(seizures)
TAB
toufit(TAB)  # same as above (method = 'ml') 

# suppose data were recorded as data.frame 
DF <- data.frame( y = as.numeric(names(TAB)), fr = as.numeric(TAB) )
DF
toufit(x = DF$y, freq = DF$fr) # same as above (method = 'ml') 
# }

Run the code above in your browser using DataLab