bpcs-package | bpcs - A package for Bayesian Paired Comparison analysis with Stan |

bpc | Bayesian Paired comparison regression models in Stan |

brasil_soccer_league | This is a dataset with the results matches fromo the first league of the Brazilian soccer championship from 2017-2019. It was reduced and translatedfrom the adaduque/Brasileirao_Dataset repository |

check_if_there_are_na | Check for NA in the specfic columns and returns T or F is there is at least 1 NA in those columns |

check_if_there_are_ties | Check if a data frame column contains ties |

check_numeric_predictor_matrix | Check if all values in the predictor matrix are numeric and not NA. Note that TRUE will be cast to 1 and FALSE will be cast to 0 |

check_predictors_df_contains_all_players | Check if the predictor df contains all players and only those |

check_result_column | Check if a data frame column contains only the values 1 0 and 2. Used to check the format of the results |

check_z_column | Check if a data frame column contains only the values 1 or 0. For the z column |

compute_scores | Giving a player0 an player1 scores, this functions adds one column to the data frame containing who won (0= player0 1=player1 2=tie) and another if it was a tie. The ties column superseeds the y column. If it was tie the y column does not matter y column: (0= player0 1=player1 2=tie) ties column (0=not tie, 1=tie) |

compute_ties | Giving a result column we create a new column with ties (0 and 1 if it has) |

create_array_of_par_names | Create an array with the parameter name and to what player/cluster it refers to in the order stan presents |

create_bpc_object | Defines the class bpc and creates the bpc object. To create we need to receive some defined parameters (the arguments from the bpc function), a lookup table and a the stanfit object generated from the rstan sampling procedure |

create_cluster_index | Create two columns with the indexes for the names of the players Here we create a new lookup table. Should be used when sampling the parameters |

create_cluster_index_with_existing_lookup_table | Create two columns with the indexes for the names Here we use an existing lookup table. Should be used in predicting |

create_index | Create two columns with the indexes for the names of the players Here we create a new lookup table. Should be used when sampling the parameters |

create_index_cluster_lookuptable | Create a lookup table of names and indexes Note that the indexes will be created in the order they appear. For string this does not make much difference but for numbers the index might be different than the actual number that appears in names |

create_index_lookuptable | Create a lookup table of names and indexes Note that the indexes will be created in the order they appear. For string this doesnt make much difference but for numbers the index might be different than the actual number that appears in names |

create_index_predictors_with_lookup_table | Receives one column with player names and returns a data frame with the relevant index columns based on a given lookup table To be used with the predictors data frame |

create_index_with_existing_lookup_table | Create two columns with the indexes for the names Here we use an existing lookup table. Should be used in predicting |

create_predictors_lookup_table | Receives a vector with predictors strings (the column names) and returns a predictor_lookup_table |

create_predictor_matrix_with_player_lookup_table | Receives a predictor dataframe, a string with the column of the player, a vector of strings with the columns for the predictors and a lookup table and returns an ordered matrix for Stan To be used with the predictors data frame |

expand_aggregated_data | Expand aggregated data Several datasets for the Bradley-Terry Model aggregate the number of wins for each player in a different column. The models we provide are intended to be used in a long format. A single result for each contest. This function expands datasets that have aggregated data into this long format. |

get_hpdi_parameters | Return the mean and the HPDI of the parameters of the model |

get_loo | Tiny wrapper for the PSIS-LOO-CV method from the loo package. |

get_model_parameters | Return all the name of parameters in a model from a bpc_object. Here we exclude the log_lik and the lp__ since they are not parameters of the model |

get_probabilities | Get the empirical win/draw probabilities based on the ability/strength parameters. Instead of calculating from the probability formula given from the model we create a predictive posterior distribution for all pair combinations and calculate the posterior wins/loose/draw The function returns the mean value of win/loose/draw for the player i. To calculate for player j the probability is 1-p_i |

get_rank_of_players | Generate a ranking of the ability based on sampling the posterior distribution of the ranks. |

get_sample_posterior | Get the posterior samples for a parameter of the model. |

get_stanfit | Retrieve the stanfit object generated by rstan. |

get_stanfit_summary | Get stanfit summary table of all parameters excluding log_lik. |

get_waic | Tiny wrapper for the WAIC method from the loo package. |

HPDI_from_stanfit | Calculate HPDI for all parameters from a stanfit object Here we use the coda package |

HPD_higher_from_column | Returns the higher value of the HPD interval for a data frame column |

HPD_lower_from_column | Returns the lower value of the HPD interval for a data frame column |

inv_logit | Inverse logit function |

launch_shinystan | Tiny wrapper to launch a shinystan app to investigate the MCMC. |

logit | Logit function |

match_cluster_names_to_cluster_lookup_table | Receives a column with cluster names and returns a data frame with the relevant index column based on a given cluster lookup table |

match_player_names_to_lookup_table | Receives two columns with player names and returns a data frame with the relevant index columns based on a given lookup table |

optimization_algorithms | Dataset containing an example of the performance of different optimization algorithms against different benchmark functions. This is a reduced version of the dataset presented at the paper: "Statistical Models for the Analysis of Optimization Algorithms with Benchmark Functions.". For details on how the data was collected we refer to the paper. |

predict.bpc | Predict results for new data. |

print.bpc | Print method for the bpc object. |

replace_parameter_index_with_names | Replace the name of the parameter from index to name using a lookup_table Receives a data frame and returns a dataframe. |

sample_stanfit | Return a data frame by resampling the posterior from a stanfit Here we select a parameter, retrieve the all the posterior from the stanfit and then we resample this posterior n times |

summary.bpc | Summary of the model bpc model. |

tennis_agresti | This is the expansion of the tennis data from Agresti (2003) p.449 This data refers to matches for several women tennis players during 1989 and 1990 |