gof.date | R Documentation |
Goodness-of-fit diagnostics for the distribution of event dates in a (assumed) Poisson process
gof.date(date,
start = NULL,
end = NULL,
plot = TRUE,
main = NULL,
skip = NULL,
plot.type = "skip")
date |
Object of class |
start |
The beginning of the interval, a |
end |
Object of class |
plot |
Should a plot be shown? |
main |
Character giving the main title of the plot. The default |
skip |
Optional data.frame with columns |
plot.type |
Character indicating the type of plot to produce when a |
In the homogeneous Poisson process, events occur on a time interval in
a uniform fashion. More precisely, for a given time interval the
distribution of the event dates conditional to their number n
is the
distribution of the order statistics of a sample of size n
of
the uniform distribution on this interval.
When the interval has limits taken at events the uniformity statement
remains true, but for inner events. This behaviour is met when
start
and end
are not given and taken as the first and
last events in date
.
A list
effKS.statistic, KS.statistic |
Kolmogorov-Smirnov global test statistic for uniformity (bilateral test) omitting slipped periods or not. |
effKS.pvalue, KS.pavalue |
Critical probability in the KS test omitting skipped periods or not. |
effnevt, nevt |
Number of events omitting skipped periods or not. |
effduration, duration |
Effective duration i.e. total duration of non-skipped periods. In years, omitting skipped periods or not. |
effrate, rate |
Occurrence rate in number of events by year, omitting skipped periods or not. |
effduration, duation |
Total duration in years, omitting missing periods or not. |
noskip |
Data.frame object giving indications on the periods that are NOT
skipped over (hence usually non-missing periods). These are :
|
When the number of events corresponding to the indications of args is
0
, the function returns NULL
with a warning. When the
number of events is less than 6
a warning is shown.
When skipped periods exist the number of events, duration, rate the
global KS test must be computed by omitting the skipped periods in the
duration and retaining only valid interevents. The indication given in
nevt
rate
and duration
should be used only when no
skipped period exist (skip = NULL
on input) and replaced by
effnevt
, effrate
and effduration
otherwise.
In practical contexts missing periods are often met in the datasets. The diagnostic should therefore be applied on every period with no missing data. Even if the event dates seem reasonably uniform, it is a good idea to check that the rates do not differ significantly over intervals.
When some events are missing and no suitable information is given via
the skip
argument, the global rate
, KS.statistic
and KS.pvalue
are of little interest. Yet the graph might be
instructive.
Yves Deville
interevt
function for the determination of interevents
ans subsequent diagnostics.
## Use "Brest" dataset
## simple plot. Kolmogorov-Smirnov is not useful
gof1 <- gof.date(date = Brest$OTdata$date)
## consider missing periods. Much better!
gof2 <- gof.date(date = Brest$OTdata$date,
skip = Brest$OTmissing,
start = Brest$OTinfo$start,
end = Brest$OTinfo$end)
print(gof2$noskip)
## Second type of graph
gof3 <- gof.date(date = Brest$OTdata$date,
skip = Brest$OTmissing,
start = Brest$OTinfo$start,
end = Brest$OTinfo$end,
plot.type = "omit")
## non-skipped periods at Brest
ns <- skip2noskip(skip = Brest$OTmissing,
start = Brest$OTinfo$start,
end = Brest$OTinfo$end)
## say 9 plots/diagnostics
oldpar <- par(mar = c(3, 4, 3, 2), mfcol = c(3, 3))
for (i in 1:9) {
GOF <- gof.date(date = Brest$OTdata$date,
start = ns$start[i],
end = ns$end[i])
}
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.