OT2MAX | R Documentation |
Temporal aggregation of a Marked Process, leading to block maxima or
r
-largest observations.
OT2MAX(OTdata,
OTmissing = NULL,
start = NULL,
end = NULL,
MAX.r = 1L,
blockDuration = "year",
monthGapStat = TRUE,
maxMissingFrac = 0.05,
dataFrames = FALSE,
infMAX = FALSE,
plot = TRUE,
plotType = c("max", "gaps"),
jitterSeed = 123,
trace = 0L,
...)
OTdata |
Data frame containing a |
OTmissing |
Optional data frame with columns |
start |
An object coerced to |
end |
An object indicating the end of the reliable/usable
information. Unless this is a end of block (1-st of January for
years), the last block will end before |
MAX.r |
Target number of observations in the blocks. Can be of length
one (same number of observations for all blocks) or of length equal
to the number of blocks, the values being then for the blocks in the
same order. In both cases, the target number may be impossible to
reach because of a smaller number of events in the block. If
|
blockDuration |
Duration of the blocks. Can only be |
monthGapStat |
Logical. Setting it to |
maxMissingFrac |
Maximal fraction of a block duration (between 0 and 1) that can be
missing without leading to a |
dataFrames |
If |
infMAX |
If |
plot |
If |
plotType |
Character controlling the plot. With |
jitterSeed |
Random seed for jittering. Used only when |
trace |
Integer level of verbosity. |
... |
Other arguments to be passed to |
The data frame given in OTdata
contains the events (or
arrivals) given by the date
column, as well as one mark
column. Depending on the argument MAX.r
, the maxima or the
r
-largest observations of the marks is computed for each time
block. When known gaps exist in the data and when they are given in
OTmissing
, a block for which the total duration of gaps is too
large will be omitted.
A list, the content of which depends on the value of
dataFrames
. If this value is TRUE
, the
following elements are returned.
MAXdata |
A data frame of largest values by block with one row for
each observation. The largest values are given as columns
with names equal to those in the |
MAXinfo |
A data frame describing the blocks, with one row by
block. The two ( |
probMissing |
A vector with values corresponding to the days in a block (year). Each value is a estimation of the probability that the day falls in a gap. If |
effDuration, r |
Vectors containing the effective duration (in years) and number of value for the blocks. |
data |
List of maxima or |
monthGapStat, monthGapTS |
Summary information concerning gaps, if |
Remind that even when maxMissingFrac
is set to its maximum
value 1.0, there can still be blocks with no data. When the result is
intended to be used in the Renouv
function, the formal
dataFrames
should be FALSE
; the elements data
and
effDuration
can then be passed as MAX.data
and
MAX.effDuration
. At the time infMAX
should also then be
set to FALSE
since -Inf
values are not yet allowed in
the r
-largest values.
## use Dunkerque data
OTdata <- Dunkerque$OTdata; OTmissing <- Dunkerque$OTmissing
## allow up to 50\% gap in a block, or only 5\%
MAX1 <- OT2MAX(OTdata = OTdata, OTmissing = OTmissing,
maxMissingFrac = 0.5,
main = "impact of the 'maxMissingFrac' formal")
MAX2 <- OT2MAX(OTdata = OTdata, OTmissing = OTmissing, dataFrames = TRUE,
prefix = "Max", maxMissingFrac = 0.05, plot = FALSE)
lines(MAX2$MAXdata$date, MAX2$MAXdata$Surge, type = "h", col = "red", lwd = 3)
legend("topleft", lw = c(1, 3), col = c("black", "orangered"),
legend = c("50\% max", " 5\% max"))
## r-largest obs for r = 4
MAX3 <- OT2MAX(OTdata, OTmissing = OTmissing, MAX.r = 4,
maxMissingFrac = 0.9,
dataFrames = FALSE, trace = TRUE,
main = "r-largest with r = 4")
## restrict the period
MAX4 <- OT2MAX(OTdata, OTmissing = OTmissing, MAX.r = 4,
start = "1962-01-01",
end = "1990-01-01",
maxMissingFrac = 0.9,
dataFrames = FALSE, trace = TRUE,
main = "r-largest with r = 4 with given 'start' and 'end'")
## Not run:
## use in a block maxima analysis, as if there were no gaps.
fit <- fGEV.MAX(MAX.data = MAX3$data,
MAX.effDuration = rep(1, length(MAX3$effDuration)))
## End(Not run)
## plot the gap rate
MAX5 <- OT2MAX(OTdata = OTdata, OTmissing = OTmissing,
maxMissingFrac = 0.5,
main = "probability of being in a gap",
plotType = "gap")
## time series plot (only <= 10 months)
plot(MAX5$monthGapTS[ , c(1:4)], main = "gap rate by month")
## much better with lattice.
## Not run:
require(lattice)
xyplot(MAX5$monthGapTS)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.