R/bpc_get_probabilities.R
get_probabilities_table.Rd
Publication-ready table for the probabilities
get_probabilities_table( bpc_object, newdata = NULL, n = 100, format = "latex", digits = 3, caption = "Estimated posterior probabilites", model_type = NULL )
bpc_object | a bpc object |
---|---|
newdata | default to NULL. If used, it will calculate the probabilities only for the newdata. Otherwise it will calculate for all combinations |
n | Number of times to sample from the posterior |
format | A character string. same formats utilized in the knitr::kable function
|
digits | number of digits in the table |
caption | a string containing the caption of the table |
model_type | when dealing with some models (such as random effects) one might want to make predictions using the estimated parameters with the random effects but without specifying the specific values of random effects to predict. Therefore one can set a subset of the model to make predictions. For example: a model sampled with bt-U can be used to make predictions of the model bt only. |
a formatted table
# \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 1 finished in 3.2 seconds. #> Chain 2 finished in 3.2 seconds. #> Chain 3 finished in 3.2 seconds. #> Chain 4 finished in 3.3 seconds. #> #> All 4 chains finished successfully. #> Mean chain execution time: 3.2 seconds. #> Total execution time: 3.4 seconds. t<-get_probabilities_table(m) print(t) #> \begin{table} #> #> \caption{Estimated posterior probabilites} #> \centering #> \begin{tabular}[t]{llrr} #> \toprule #> i & j & i\_beats\_j & j\_beats\_i\\ #> \midrule #> Graf & Navratilova & 0.77 & 0.23\\ #> Graf & Sabatini & 0.80 & 0.20\\ #> Graf & Sanchez & 0.84 & 0.16\\ #> Graf & Seles & 0.54 & 0.46\\ #> Navratilova & Sabatini & 0.54 & 0.46\\ #> \addlinespace #> Navratilova & Sanchez & 0.77 & 0.23\\ #> Navratilova & Seles & 0.31 & 0.69\\ #> Sabatini & Sanchez & 0.72 & 0.28\\ #> Sabatini & Seles & 0.29 & 0.71\\ #> Sanchez & Seles & 0.24 & 0.76\\ #> \bottomrule #> \end{tabular} #> \end{table} # }