Description Usage Arguments Details Value References See Also Examples
View source: R/find.threshold.R
Evaluate different combinations of threshold and indicator weightings according to their sensitivity and specificity.
1 2 3 4 5 |
indicators |
List of matrices containing the lagged covariates to construct weighted indicators. Can also be a matrix in the case of a single indicator. |
episodes |
A matrix or data.frame containing the indices of extreme
episodes. Must contain the time indices in the first column and the
corresponding episode index in the second column as returned by
|
u.grid |
A list of vectors containing the grid of thresholds to be
considered. The list must have the same number of elements than
|
fixed.alphas |
A list of optional prefixed weightings for a subset of
indicators. When provided, must have the same length as |
alpha.step |
Numeric value between 0 and .5. The step of the sequence of weightings tested for the indicator. |
decreasing.alphas |
Logical. If TRUE (the default), the alpha weightings are constrained to decrease with the lag. |
same.alphas |
Logical. If TRUE, the weightings are constrained to be
identical for each indicator. Note that trying different weightings
( |
order.result |
Character or numeric value indicating a column used to order the returned table. Can also be a vector. |
order.decreasing |
Logical. If TRUE (the default), ordering of the
table is made by decreasing order to the column specified by
|
r |
Positive integer. Number of consecutive values below threshold
following an excess to end the episode. By default, take the attribute
|
trim |
Positive integer. If not |
thinning |
Character string indicating if the results should be thinned
before returning. When |
progressBar |
Logical indicating if a progressBar is displayed during execution of the function. If TRUE, may greatly increase execution time. |
We consider a warning system as a couple indicator/threshold
used to launch alerts when forecasts of the indicator exceed the
threshold. In the present function, the indicators considered are
linear combinations of all matrix columns in the parameter
indicators
, with the constraint that, for each indicator, the
weights sum to 1.
The indicator and threshold are determined by evaluating a large range
of different weightings and threshold (given in u.grid
and
alpha.step
). For each combination of indicators/thresholds,
the function computes the indices corresponding to alerts in the data
and compare them to the actual values given in episodes
. If
thinning != "none"
) the function then selects a subset of best
candidates for which the number of detected days are maximum while the
number of false alarms is minimum. Note that if
thinning = "episodes"
, the subset is selected on the basis of
detected and false episodes instead of days. It is left to the user to
choose the best combination by a trade-off between specificity and
sensitivity.
A data.frame containing a subset (unless thinning = "none"
)
of weightings and thresholds. Weightings correspond to the columns
with a name containing "alpha" and threshold to names beginning with
"threshold". In addition, several scores are given in each line:
Detected |
The number of indices in |
Missed |
The number of indices in |
Sensitivity |
The proportion of indices in |
False_alarms |
The number of false alarms, i.e. of indices
found by the combination which are not in |
Specificity |
The proportion of false alarms, i.e. False_alarms / n. |
Episodes_found |
The number of episodes found. An episode is found when at least one of its days is found. |
Episodes_sensitivity |
The proportion of episodes found. |
False_episodes |
The number of false episodes found, i.e. absent
from the provides |
Chebana F., Martel B., Gosselin P., Giroux J.X., Ouarda T.B.M.J., 2013. A general and flexible methodology to define thresholds for heat health watch and warning systems, applied to the province of Quebec (Canada). International journal of biometeorology 57, 631-644.
Pascal M., Laaidi K., Ledrans M., Baffert E., Caserio-Schonemann C., Le Tertre A., Manach J., Medina S., Rudant J., Empereur-Bissonnet P., 2006. France's heat health watch warning system. International journal of biometeorology 50, 144-153.
episodes
for extracting episodes of extreme values and
predict_alarms
for alarms prediction.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(dlnm)
data(chicagoNMMAPS)
x <- chicagoNMMAPS$death
dates <- as.POSIXlt(chicagoNMMAPS$date)
n <- nrow(chicagoNMMAPS)
# Compute over-mortality
om <- excess(x, dates = dates, order = 15)
# Extract all days for which om is above 40%
epis <- episodes(om, u = 40)
# Prepare indicator based on temperature until lag 2
indic <- matrix(NA, nrow = n, ncol = 3)
indic[,1] <- chicagoNMMAPS$temp # lag 0
indic[,2] <- c(NA, chicagoNMMAPS$temp[-n]) # Lag 1
indic[,3] <- c(NA, NA, chicagoNMMAPS$temp[1:(n-2)]) # lag 2
# Evaluate different threshold/indicators based on these episodes
find.threshold(indic, epis, u.grid = 20:35, thinning = "episodes",
order.result = "Episodes_found")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.