dbl_run: Dynamic Bayesian Logit

Description Usage Arguments Value Examples

View source: R/rating_run.R

Description

Dynamic Bayesian Logit

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
dbl_run(
  formula,
  data,
  r = NULL,
  rd = NULL,
  lambda = NULL,
  weight = NULL,
  kappa = 0.95,
  init_r = 0,
  init_rd = 1
)

Arguments

formula

formula which specifies the model. Unlike other algorithms in the packages (glicko_run, glicko2_run, bbt_run), this method doesn't allow players nested in teams with 'player(player | team)' and user should matchup in formula using 'player(player)'. DBL allows user specify multiple parameters also in interaction with others.

data

data.frame which contains columns specified in formula, and optional columns defined by lambda, weight.

r

named vector of initial players ratings estimates. If not specified then r will be created automatically for parameters specified in formula with initial value init_r.

rd

rd named vector of initial rating deviation estimates. If not specified then rd will be created automatically for parameters specified in formula with initial value init_rd.

lambda

name of the column in 'data' containing lambda values or one constant value (eg. lambda = colname or lambda = 0.5). Lambda impact prior variance, and uncertainty of the matchup result. The higher lambda, the higher prior variance and more uncertain result of the matchup. Higher lambda flattens chances of winning.

weight

name of the column in 'data' containing weights values or one constant (eg. weight = colname or weight = 0.5). Weights increasing (weight > 1) or decreasing (weight < 1) update change. Higher weight increasing impact of event result on rating estimate.

kappa

controls rd shrinkage not to be greater than rd*(1 - kappa). 'kappa=1' means that rd will not be decreased.

init_r

initial values for r if not provided. Default (glicko = 1500, glicko2 = 1500, bbt = 25, dbl = 0)

init_rd

initial values for rd if not provided. Default (glicko = 350, glicko2 = 350, bbt = 25/3, dbl = 1)

Value

A "rating" object is returned:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# the simplest example

data <- data.frame(
  id = c(1, 1, 1, 1),
  name = c("A", "B", "C", "D"),
  rank = c(3, 4, 1, 2),
  gate = c(1, 2, 3, 4),
  factor1 = c("a", "a", "b", "b"),
  factor2 = c("a", "b", "a", "b")
)

dbl <- dbl_run(
  data = data, 
  formula = rank | id ~ player(name)
 )

dbl <- dbl_run(
  data = data, 
  formula = rank | id ~ player(name) + gate * factor1)

sport documentation built on April 17, 2020, 1:27 a.m.