tournament | R Documentation |
tournament compares four rating curve models of different complexities and determines the model that provides the best fit of the data at hand.
tournament(
formula = NULL,
data = NULL,
model_list = NULL,
method = "WAIC",
winning_criteria = NULL,
verbose = TRUE,
...
)
formula |
An object of class "formula", with discharge column name as response and stage column name as a covariate. |
data |
A data.frame containing the variables specified in formula. |
model_list |
A list of exactly four model objects of types "plm0","plm","gplm0" and "gplm" to be used in the tournament. Note that all of the model objects are required to be run with the same data and same c_param. |
method |
A string specifying the method used to estimate the predictive performance of the models. The allowed methods are "WAIC", "DIC" and "PMP". |
winning_criteria |
Specifies the criteria for model selection. For "WAIC", it can be a numeric value or a string expression. For "DIC", it must be a numeric value. For "PMP", it must be a numeric value between 0 and 1. See Details section. |
verbose |
A logical value indicating whether to print progress and diagnostic information. If 'TRUE', the function will print messages as it runs. If 'FALSE', the function will run silently. Default is 'TRUE'. |
... |
Optional arguments passed to the model functions. |
Tournament is a model comparison method that uses WAIC (default method) to estimate the expected prediction error of the four models and select the most appropriate model given the data. The first round of model comparisons sets up model types, "gplm" vs. "gplm0" and "plm" vs. "plm0". The two comparisons are conducted such that if the WAIC of the more complex model ("gplm" and "plm", respectively) is smaller than the WAIC of the simpler models ("gplm0" and "plm0", respectively) by an input argument called the winning_criteria
(default value = 2), then it is chosen as the more appropriate model. If not, the simpler model is chosen. The more appropriate models move on to the second round and are compared in the same way. The winner of the second round is chosen as the overall tournament winner and deemed the most appropriate model given the data.
The default method "WAIC", or the Widely Applicable Information Criterion (see Watanabe (2010)), is used to estimate the predictive performance of the models. This method is a fully Bayesian method that uses the full set of posterior draws to estimate of the expected log pointwise predictive density.
Method "DIC", or Deviance Information Criterion (see Spiegelhalter (2002)), is similar to the "WAIC" but instead of using the full set of posterior draws to compute the estimate of the expected log pointwise predictive density, it uses a point estimate of the posterior distribution.
Method "PMP" uses the posterior model probabilities, calculated with Bayes factor (see Jeffreys (1961) and Kass and Raftery (1995)), to compare the models, where all the models are assumed a priori to be equally likely. This method is not chosen as the default method because the Bayes factor calculations can be quite unstable.
When method "WAIC" is used, the winning_criteria
can be either a numeric value or a string expression. If numeric, it sets the threshold which the more complex model must exceed to be declared the more appropriate model. If a string, it must be a valid R expression using Delta_WAIC and/or SE_Delta_WAIC (e.g., "Delta_WAIC > 2 & Delta_WAIC - SE_Delta_WAIC > 0"). For method "DIC", winning_criteria
must be a numeric value. For method "PMP", the winning criteria should be a numeric value between 0 and 1 (default value = 0.75). This sets the threshold value for which the posterior probability of the more complex model, given the data, in each model comparison must exceed to be declared the more appropriate model. In all cases, the default values are selected to give the less complex models a slight advantage, which should give more or less consistent results when applying the tournament to real world data.
An object of type "tournament" with the following elements:
contestants
The model objects of types "plm0", "plm", "gplm0" and "gplm" being compared.
winner
The model object of the tournament winner.
info
The specifics about the tournament; the overall winner; the method used; and the winning criteria.
summary
A data frame with information on results of the different comparisons in the power-law tournament. The contents of this data frame depend on the method used:
For all methods:
round: The tournament round
comparison: The comparison number
complexity: Indicates whether a model is the "more" or "less" complex model in a comparison
model: The model type
winner: Logical value indicating if the model was selected in the corresponding comparison
Additional columns for method "WAIC":
lppd: Log pointwise predictive density
eff_num_param: Effective number of parameters (WAIC)
WAIC: Widely Applicable Information Criterion
SE_WAIC: Standard error of WAIC
Delta_WAIC: Difference in WAIC
SE_Delta_WAIC: Standard error of the difference in WAIC
Additional columns for method "DIC":
D_hat: Minus two times the log-likelihood evaluated at the median of the posterior samples
eff_num_param: Effective number of parameters (DIC)
DIC: Deviance Information Criterion
Delta_DIC: Difference in DIC
Additional columns for method "PMP":
log_marg_lik: Logarithm of the marginal likelihood estimated, computed with the harmonic-mean estimator
PMP: Posterior model probability computed with Bayes factor
Hrafnkelsson, B., Sigurdarson, H., Rögnvaldsson, S., Jansson, A. Ö., Vias, R. D., and Gardarsson, S. M. (2022). Generalization of the power-law rating curve using hydrodynamic theory and Bayesian hierarchical modeling, Environmetrics, 33(2):e2711. doi: https://doi.org/10.1002/env.2711
Jeffreys, H. (1961). Theory of Probability, Third Edition. Oxford University Press.
Kass, R., and A. Raftery, A. (1995). Bayes Factors. Journal of the American Statistical Association, 90, 773-795. doi: https://doi.org/10.1080/01621459.1995.10476572
Spiegelhalter, D., Best, N., Carlin, B., Van Der Linde, A. (2002). Bayesian measures of model complexity and fit. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 64(4), 583–639. doi: https://doi.org/10.1111/1467-9868.00353
Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and widely applicable information criterion in singular learning theory. J. Mach. Learn. Res. 11, 3571–3594.
plm0
plm
, gplm0
,gplm
summary.tournament
and plot.tournament
data(krokfors)
set.seed(1)
t_obj <- tournament(formula = Q ~ W, data = krokfors, num_cores = 2)
t_obj
summary(t_obj)
# Using different methods and winning criteria
t_obj_dic <- tournament(Q ~ W,
krokfors,
num_cores = 2,
method = "DIC",
winning_criteria = 3)
t_obj_pmp <- tournament(Q ~ W,
krokfors,
num_cores = 2,
method = "PMP",
winning_criteria = 0.8)
t_obj_waic_expr <- tournament(Q ~ W,
krokfors,
num_cores = 2,
winning_criteria = "Delta_WAIC > 2 & Delta_WAIC - SE_Delta_WAIC > 0")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.