Return a data frame with the posterior samples for the parameters of the model

get_sample_posterior(bpc_object, par = "lambda", n = 1000, keep_par_name = T)

Arguments

bpc_object

a bpc object

par

name of the parameters to predict

n

how many times are we sampling? Default 1000

keep_par_name

keep the parameter name e.g. lambda Graff instead of Graff. Default to T. Only valid for lambda, so we can have better ranks

Value

Return a data frame with the posterior samples for the parameters. One column for each parameter one row for each sample

Examples

# \donttest{
m<-bpc(data = tennis_agresti,
player0 = 'player0',
player1 = 'player1',
result_column = 'y',
model_type = 'bt',
solve_ties = 'none')
#> Running MCMC with 4 parallel chains...
#> 
#> Chain 3 finished in 2.9 seconds.
#> Chain 1 finished in 3.0 seconds.
#> Chain 2 finished in 3.0 seconds.
#> Chain 4 finished in 3.1 seconds.
#> 
#> All 4 chains finished successfully.
#> Mean chain execution time: 3.0 seconds.
#> Total execution time: 3.4 seconds.
s <- get_sample_posterior(m, par='lambda', n=100)
print(head(s))
#>   lambda[Seles] lambda[Graf] lambda[Sabatini] lambda[Navratilova]
#> 1      1.075310     1.321660        0.7996070            0.781848
#> 2     -0.452489    -1.171200       -1.6845700           -0.101250
#> 3      1.139730     1.073020       -0.0639030           -0.351571
#> 4      1.293570     1.635660       -0.0155847            1.124450
#> 5      0.890889     0.867766       -0.4522100            0.897308
#> 6      0.900793     0.942807        0.0115837            1.145680
#>   lambda[Sanchez]
#> 1      -0.7785050
#> 2      -2.2863900
#> 3      -0.8310020
#> 4      -0.0871835
#> 5      -0.1073960
#> 6       0.3915680
# }