View source: R/barplotRenouv.R
barplotRenouv | R Documentation |
Barplot for "Over Threshold" counts in time blocks (usually years)
barplotRenouv(data,
blockname = colnames(data)[1],
varname = colnames(data)[2],
threshold = quantile(data[, varname], 0.2),
na.block = NULL,
plot = TRUE,
main = NULL, xlab = NULL, ylab = NULL,
mono = FALSE,
prob.theo = 0.999,
...)
data |
A dataframe object containing the variables. |
blockname |
Name of the "block" variable (column in |
varname |
Name of the variable (e.g. |
threshold |
Only obs for which the variable exceeds |
na.block |
Values of blocks containing missing values. See the Details section. |
plot |
If |
main |
Character for main title or |
xlab |
Character for x axis label or |
ylab |
Character for y axis or |
mono |
If |
prob.theo |
The total theoretical probability corresponding to the plotted (theoretical) bars. |
... |
Further args to be passed to
|
Blocks described in the na.block
are omitted in the
determination of counts. The object given in the na.block
is
coerced to character and the same is done for values of block
before comparing them to the na.block
values. If block
variable is of class factor with levels representing years
(e.g. 1980, 1981, etc.) missing blocks can be specified either as
c("1980", "1981")
or as numeric c(1980, 1981)
.
For the chi-square test, counts for neighbouring frequency classes are
grouped in order to reach a minimum frequency of 5
in each
group. E.g. if we expect respectively 1.0
, 3.8
and
7.0
blocks with frequency 0
, 1
and 2
for
events, the three counts are grouped in one group with frequency
1.0+3.8+7.0=11.8
. Note that this strategy of grouping is not
unique and is likely to weaken the power of the test. Before
grouping, the higher class theoretical probability is computed as the
probability to obtain a count equal to or greater than the max value.
A list with the following objects.
freq |
frequency table (matrix) giving observed and theoretical (Poisson) frequencies as well as a group number for the chi-square test. |
overdispersion |
the overdispersion coefficient (variance/mean ratio). |
disp.test |
a list giving results of the (over)dispersion test. See the reference Yagouti and al. in the References section. |
chisq.test |
a list giving results for the chis-square test of goodness-of-fit to the Poisson distribution. |
tests |
a matrix with the two tests displayed in two rows. |
For both tests, the statistic follows a chi-square distribution under the
null hypothesis . The list of results contains the statistic
statistic
, the number of degrees of freedom df
and
the p
-value p.value
.
The two tests: (over-)dispersion and chi-square have one-sided (upper
tail) p
-value. In other words, we do not intend to reject when
statistics take "abnormally small" values, but only when abnormally
large values are met.
Yves Deville
See Yagouti A., Abi-Zeid I., Ouarda, T.B.M.J. and B. Bobée (2001), Revue de processus ponctuels et synthèse de tests statistiques pour le choix d'un type de processus Revue des Sciences de l'Eau, 1, pp. 323-361.
plot.Rendata
## na.block influence for Brest data
opar <- par(mfrow = c(2, 2))
bp1 <- barplotRenouv(data = Brest.years, threshold = 30,
main = "missing periods ignored")
bp2 <- barplotRenouv(data = Brest.years, threshold = 30,
na.block = 1992, main = "1992 missing")
bp3 <- barplotRenouv(data = Brest.years, threshold = 30,
na.block = 1991:1993, main ="1991:1993 missing")
bp4 <- barplotRenouv(data = Brest.years, threshold = 30,
na.block = Brest.years.missing, main = "all missing periods")
par(opar)
## threshold influence
opar <- par(mfrow = c(2,2))
thresh <- c(30, 35, 40, 50)
for (i in 1:length(thresh)) {
bp <- barplotRenouv(data = Brest.years, threshold = thresh[i],
na.block = Brest.years.missing,
main = paste("threshold =", thresh[i], "cm at Brest"))
}
par(opar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.