Description Usage Arguments Value References Examples
This is the main function of the package. This function utilizes precompiled stan models to sample the posterior distribution of the specified model with the input data. For more information and larger examples of usage see the vignettes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
data |
A data frame containing the observations. The other parameters specify the name of the columns |
player0 |
A string with name of the column containing the players 0. This column should be of string/character type and not be of factor type. |
player1 |
A string with name of the column containing the players 0. This column should be of string/character type and not be of factor type. |
player0_score |
A string with name of the column containing the scores of players 0 |
player1_score |
A string with name of the column containing the scores of players 1 |
result_column |
A string with name of the column containing the winners. 0 for player 0, 1 for player 1 and 2 for ties |
z_player1 |
A string with the name of the column containing the order effect for player 1. E.g. if player1 has the home advantage this column should have 1 otherwise it should have 0 |
cluster |
A string with the name of the column containing the cluster for the observation. To be used with a random effects model. This column should contain strings |
predictors |
A data frame that contains the players predictors values when using a generalized model. Only numeric values are accepted. Booleans are accepted but will be cast into integers. The first column should be for the player name, the others will be the predictors. The column names will be used as name for the predictors |
model_type |
We first add a base model 'bt' or 'davidson' and then additional options with '-'
|
solve_ties |
A string for the method of handling ties.
|
win_score |
A string that indicates if which score should win
|
priors |
A list with the parameters for the priors.
|
chains |
Number of chains passed to Stan sampling. Positive integer, default=4. For more information consult Stan documentation |
iter |
Number of iterations passed to Stan sampling. Positive integer, default =2000. For more information consult Stan documentation |
warmup |
Number of iteration for the warmup passed to Stan sampling. Positive integer, default 1000. For more information consult Stan documentation |
show_chain_messages |
Hide chain messages from Stan |
seed |
a random seed for Stan |
An object of the class bpc. This object should be used in conjunction with the several auxiliary functions from the package
Bradley RA, Terry ME 1952. Rank Analysis of Incomplete Block Designs I: The Method of Paired Comparisons. Biometrika, 39, 324 45.
Davidson RR 1970. On Extending the Bradley-Terry Model to Accommodate Ties in Paired Comparison Experiments. Journal of the American Statistical Association, 65, 317 328.
Davidson, Roger R., and Robert J. Beaver 1977. "n extending the Bradley-Terry model to incorporate within-pair order effects. Biometrics: 693 702.
Stan Development Team 2020. RStan: the R interface to Stan. R package version 2.21.2.
Bockenholt, Ulf. Hierarchical modeling of paired comparison data. Psychological Methods 6.1 2001: 49.
Springall, A. Response Surface Fitting Using a Generalization of the Bradley-Terry Paired Comparison Model. Journal of the Royal Statistical Society: Series C Applied Statistics 22.1 1973: 59 68.
1 2 3 4 5 6 7 | #For the simple Bradley-Terry model
bpc(data = tennis_agresti,
player0 = 'player0',
player1 = 'player1',
result_column = 'y',
model_type = 'bt',
solve_ties = 'none')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.