Fit duration models with the maximum likelihood method to a given duration data set. The data can be censored. The models should be among the following list: inverse Gaussian, log normal, log logistic, gamma, Weibull, refractory exponential. The Akaike information criterion (AIC) is used to produce a numerical output. Diagnostic QQ or survival plots can also be generated.
1 2 3 4 
yi 
vector of (possibly binned) observations or a

ni 
vector of counts for each value of 
si 
vector of counts of uncensored observations for each
value of 
models 
a character vector whose elements are selected among:

type 
should a QQ plot ( 
log 
should a log scale be used? 
plot 
should a plot be generated? 
Fits are performed by maximizing the likelihood.
A vector whose component are nammed according to the model used and ordered along increasing AIC values.
if argument plot
is set to TRUE
(the default), a plot is
generated as a side effect.
Christophe Pouzat christophe.pouzat@gmail.com
Lindsey, J.K. (2004) The Statistical Analysis of Stochastic Processes in Time. CUP.
qqDuration
,
invgaussMLE
,
lnormMLE
,
llogisMLE
,
rexpMLE
,
gammaMLE
,
weibullMLE
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 41 42  ## Not run:
## load spontaneous data of 4 putative projection neurons
## simultaneously recorded from the cockroach (Periplaneta
## americana) antennal lobe
data(CAL1S)
## convert data into spikeTrain objects
CAL1S < lapply(CAL1S,as.spikeTrain)
## look at the individual trains
## first the "raw" data
CAL1S[["neuron 1"]]
## next some summary information
summary(CAL1S[["neuron 1"]])
## next the renewal tests
renewalTestPlot(CAL1S[["neuron 1"]])
## It does not look too bad so let fit simple models
compModels(CAL1S[["neuron 1"]])
## Simulate a sample with 100 events from an inverse Gaussian
set.seed(1102006,"MersenneTwister")
mu.true < 0.075
sigma2.true < 3
sampleSize < 100
sampIG < rinvgauss(sampleSize,mu=mu.true,sigma2=sigma2.true)
## Compare models and display QQ plot
compModels(sampIG,type="qq")
## Compare models and display survival plot
compModels(sampIG,type="s")
## Generate a censored sample using an exponential distribution
sampEXP < rexp(sampleSize,1/(2*mu.true))
sampIGtime < pmin(sampIG,sampEXP)
sampIGstatus < as.numeric(sampIG <= sampEXP)
## Compare models and display QQ plot
## WARNING with censored data like here the QQ plot is misleading
compModels(yi=sampIGtime,si=sampIGstatus,type="qq")
## Compare models and display survival plot
compModels(yi=sampIGtime,si=sampIGstatus,type="s")
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.