# Evolutionary Version of the Metropolis-Hastings Algorithm

## Documentation for package ‘emcAdr’ version 1.3

- DESCRIPTION file
- User guides, package vignettes and other documentation
- Package README

## Help Pages

emcAdr-package | Evolutionary Version of the Metropolis-Hastings Algorithm
ATCtoNumeric | Convert ATC Code for each patients to the corresponding DFS number of the ATC tree
ATC_Tree_UpperBound_2024 | ATC Tree Upper Bound 2024
calculate_divergence | Calculate the divergence between 2 distributions (the true Distribution and the learned one)
clustering_genetic_algorithm | Clustering of the solutions of the genetic algorithm using the hclust algorithm
combination_data_frame | Generate Matrix for Drug Combinations
computeMetrics_size2 | Function used in the reference article to compare diverse Disproportionality Analysis metrics
compute_hypergeom_cocktail | Function used to compute the Hypergeometric score on a cocktail
compute_hypergeom_on_list | Function used to compute the Hypergeometric score on a list of cocktails
compute_RR_on_list | Function used to compute the Relative Risk on a list of cocktails
csv_to_population | Function used to convert your genetic algorithm results that are stored into a .csv file to a Data structure that can be used by the clustering algorithm
DistributionApproximation | The MCMC method that runs the random walk on a single cocktail in order to estimate the distribution of score among cocktails of size Smax.
emcAdr | Evolutionary Version of the Metropolis-Hastings Algorithm
FAERS_myopathy | FAERS Myopathy Dataset
GeneticAlgorithm | Genetic algorithm, trying to reach riskiest cocktails (the ones which maximize the fitness function, Hypergeometric score in our case)
get_dissimilarity_from_cocktail_list | Recover the square matrix of distance between cocktails where the index (i,j) of the matrix is the distance between cocktails i and j in an arbitrary cocktail list
get_dissimilarity_from_genetic_results | Recover the square matrix of distance between cocktails where the index (i,j) of the matrix is the distance between cocktails i and j in the genetic_results list.
get_dissimilarity_from_txt_file | Recover the square matrix of distance between cocktails where the index (i,j) of the matrix is the distance between cocktails i and j in the csv file containing results of genetic algorithm
hclust_genetic_solution | Clustering of the solutions of the genetic algorithm using the hclust algorithm
histogramToDitribution | Convert the histogram returned by the DistributionApproximation function, to a real number distribution (that can be used in a test for example)
hyperparam_test_genetic_algorithm | This function can be used in order to try different set of parameters for the genetic algorithm in a convenient way. This will run each combination of mutation_rate, nb_elite and alphas possible nb_test_desired times. For each sets of parameters, results will be saved in a file named according to the set of parameter. One can regroup the results of each run in a csv file by using the print_csv function specifying the names of each file that needs to be treated and the number of performed runs on each parameter set
int_cocktail_to_string_cocktail | Function used to convert integer cocktails (like the one outputed by the distributionApproximation function) to string cocktail in order to make them more readable
OutsandingScoreToDistribution | Output the outstanding score (Outstanding_score) outputed by the MCMC algorithm in a special format
plot_evolution | Plot the evolution of the mean and the best value of the population used by the GeneticAlgorithm
plot_frequency | Plot the histogram of the approximation of the RR distribution
print_csv | Print every cocktails found during the genetic algorithm when used with the hyperparam_test_genetic_algorithm function. This enables to condense the solutions found in each files by collapsing similar cocktail in a single row by cocktail.
p_value_cocktails | Used to add the p_value to each cocktail of cocktail list
p_value_csv_file | Used to add the p_value to each cocktail of a csv_file that is an output of the genetic algorithm
p_value_genetic_results | Used to add the p_value to each cocktail of an output of the genetic algorithm
p_value_on_sampled | Calculate p-value of sampled value
qq_plot_output | Make a Quantile-Quantile diagram from the output of the MCMC algorithm (DistributionAproximation) and the algorithm that exhaustively calculates the distribution
remove_higher_cocktails | Filter out drug cocktails with high-level ATC classifications
run_firth_regression | Firth Penalized Logistic Regression for Drug Cocktails
string_list_to_int_cocktails | Function used to convert a string vector of drugs in form "drug1:drug2" to a vector of index of the ATC tree ex: c(ATC_index(drug1), ATC_index(drugs2))
trueDistributionDrugs | The true distribution of the score among every single nodes of the ATC
trueDistributionSizeTwoCocktail | The true distribution of the score among every size-two cocktails