# HierIsingplot: Plot for two Bayesian models In ganluan123/FlagAE: Flag adverse events by Bayesian methods

## Description

These two functions are for plotting the top AEs selected by Bayesian hierarchical model and Bayesian model with Ising prior and producing table with detailed information fo these AEs.

## Usage

 ```1 2 3 4``` ```HIplot(hierdata, isingdata, aedata, ptnum = 10, param = "risk difference", OR_xlim = c(0, 5)) HItable(hierdata, isingdata, ptnum = 10, param = "risk difference") ```

## Arguments

 `hierdata` output from function `Hier` `isingdata` output from function `Ising` `ptnum` positive integer, number of AEs to be selected or plotted, default is 10 `param` a string, either "odds ratio" or "risk difference", indicate which summary statistic to be based on to plot the top AEs, default is "risk difference" `OR_ylim` a numeric vector of two elements, used to set y-axis limit for plotting based on "odds ratio"

## Details

`HIplot` first selects the top `ptnum` (an integer) AE based on the selected statistic (either "odds ratio" or "risk difference"). Then it plots the mean, 2.5 the AEs slected by both Bayesian methods from AEs selected by only one method. Also it indicates whether the AE selected by these two Bayesian models were also selected by only based on incidence difference (function `BCItable`).
`HItable` creates a table for the detailed information for AE plotted in `HIplot`.

## Value

`HIplot` returns a plot for the top `ptnum` (an integer) AE based on the selected statistics (either "odds ratio" or "risk difference"). Mean, 2.5 quantile, 97.5
`HItable` returns a table for the detailed information for AE plotted in `HIplot`. It contains a new column, "rank_diff_mean" or "rank_OR_median" (based on the `param`), besides the columns of output from `Hier` or `Ising`. This new column is the rank of "Diff_mean" or "OR_median" of the AE in each method.

`preprocess`, `Hier`, `Ising`, `BCItable`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19``` ```## Not run: data(ADAE) data(ADSL) AEdata<-preprocess(adsl=ADSL, adae=ADAE) # run the Hierarchical model HIERDATA<-Hier(aedata=AEdata, n_burn=1000, n_iter=1000, thin=20, n_adapt=1000, n_chain=2) # run the Ising model ISINGDATA<-Ising(aedata = AEdata, n_burn=1000, n_iter=5000, thin=20, alpha_=0.5, beta_=0.5, alpha.t=0.5, beta.t=0.5, alpha.c=0.25, beta.c=0.75, rho=1, theta=0.02) HIplot(hierdata=HIERDATA, isingdata=ISINGDATA, aedata=AEdata) HIplot(hierdata=HIERDATA, isingdata=ISINGDATA, aedata=AEdata, ptnum=15, param="odds ratio", OR_xlim=c(0,20)) HItable(hierdata=HIERDATA, isingdata=ISINGDATA, aedata=AEdata) HItable(hierdata=HIERDATA, isingdata=ISINGDATA, aedata=AEdata, ptnum=15, param="odds ratio") ## End(Not run) ```