Description Usage Arguments Details Value Note References See Also Examples
Functions here are to take the orginized data (output from
preprocess
) and apply the Bayesian model with Ising latent variables.
See details for model description and difference between each function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Ising_history(aedata, n_burn, n_iter, thin, alpha_ = 0.25,
beta_ = 0.75, alpha.t = 0.25, beta.t = 0.75, alpha.c = 0.25,
beta.c = 0.75, rho, theta)
sum_Ising(isingraw)
Ising(aedata, n_burn, n_iter, thin, alpha_ = 0.25, beta_ = 0.75,
alpha.t = 0.25, beta.t = 0.75, alpha.c = 0.25, beta.c = 0.75,
rho, theta)
Isinggetpi(aedata, isingraw)
Isingplot(isingdata, ptnum = 10, param = "risk difference",
OR_xlim = c(0, 5))
Isingtable(isingdata, ptnum = 10, param = "risk difference")
|
aedata |
output from function |
n_burn |
number of burn in for Gibbs Sampling |
n_iter |
number of interation for Gibbs Sampling |
thin |
thin for Gibbs Samping, parameters are recorded every thin-th interation |
alpha_ |
numeric, is the prior for beta distribution, beta distribution for both treatment and control group, alpha parameter of beta distribution |
beta_ |
numeric, is the prior for beta distribution, beta distribution for both treatment and control group, beta parameter of beta distribution |
alpha.t |
numeric, is the prior for beta distribution, beta distribution for treatment group, alpha parameter of beta distribution |
beta.t |
numeric, is the prior for beta distribution, beta distribution for treatment group, beta parameter of beta distribution |
alpha.c |
numeric, is the prior for beta distribution, beta distribution for control group, alpha parameter of beta distribution |
beta.c |
numeric, is the prior for beta distribution, beta distribution for control group, beta parameter of beta distribution |
rho |
either a number or numeric vector with length equals to the number of rows of data frame aedata. If it is a single number, then all adverse events use the same hyperparameter of rho. If it is a numeric vector, then each AE has its own hyperparameter of rho, and the sequence of rho value for each AE should be the same as the sequence of AE in aedata (AE in aedata should be ordered by b and j). |
theta |
numeric, |
isingraw |
output from function |
isingdata |
output from function |
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" |
Model:
The model is based on the paper McEvoy, Bradley W., Rajesh R. Nandy, and Ram C. Tiwari.
"Bayesian approach for clinical trial safety data using an Ising prior."
Biometrics 69.3 (2013): 661-672.
Ising_history
:
This function takes formatted Binomial data and
performs the Bayesian analysis with Ising prior.#'
sum_Ising
:
This function takes the result from function Ising_history
as input
and summarizes the result from Ising_history
.
Ising
:
This function takes the same parameters as function Ising_history
this function will take first take the result from Ising_history
and
then summarize the result for each AE and merge the result with the raw data,and also the Raw risk difference, Raw odds ratio calculated from raw data.
Isinggetpi
:
This function calculates pit (incidence of AE in treatment group) and
pic (incidence of AE in control group) from the output of Ising_history
Isingplot
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
color.
Isingtable
creates a table for the detailed information for AE plotted in Isingplot
.
Ising_history
returns a list with 3 matries, gamma, pi.t, and pi.c.
Each row of these three matries correspond to one recoreded iteration.
And each column of these three matries correspond to each of the AE.
gamma matrix records the indicator of non-differential risk for each AE.
pi.t records the incidence risk of treatment group for each AE.
pi.c records the incidence risk of control group for each AE.
sum_Ising
returns the summary statistics for each AE.(Note: all the apply function are apply
on column, thus will result the summary statistics for each AE).
Ising
returns the summary statistics for each AE combining with the raw data. The summary statistics include
summary statistics for incidence rate difference (mean, 2.5% and 97.5% percentile),
summary statistics for odds ratio (mean, 2.5% and 97.5% percentile), and also the mean of gamma, with is the probability of gamma=1.
The other columns from raw data include SoC, PT, Nt, Nc, AEt, AEc.
Isinggetpi
:
This function calculates pit (incidence of AE in treatment group) and
pic (incidence of AE in control group) from the output of Ising_history
.
The incidence difference is calculated by (t-c) and the odds ratio is calculated by t(1-c)/c(1-t), where t,c are
the incidences of one AE for treatment and control group, respectively.
McEvoy, Bradley W., Rajesh R. Nandy, and Ram C. Tiwari. "Bayesian approach for clinical trial safety data using an Ising prior." Biometrics 69.3 (2013): 661-672.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
data(ADAE)
data(ADSL)
AEdata<-preprocess(adsl=ADSL, adae=ADAE)
RHO<-rep(1,dim(AEdata)[1])
ISINGRAW<-Ising_history(aedata = AEdata, n_burn=1000, n_iter=5000, thin=20, rho=1, theta=0.02)
ISINGRAW2<-Ising_history(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=RHO, theta=0.02)
SUM_ISING<-sum_Ising(ISINGRAW)
ISINGDATA<-Ising(aedata = AEdata, n_burn=1000, n_iter=5000, thin=20, rho=1, theta=0.02)
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=RHO, theta=0.02)
ISINGPI<-Isinggetpi(aedata = AEdata, isingraw=ISINGRAW)
Isingplot(ISINGDATA)
Isingplot(ISINGDATA, ptnum=15, param="odds ratio", OR_xlim=c(1,10))
ISINGTABLE<-Isingtable(ISINGDATA)
ISINGTABLE2<-Isingtable(ISINGDATA, ptnum=15, param="odds ratio")
Compareplot(ISINGDATA)
# user can use a very big number(bigger than total PTs in dataset) to plot out all the PTs
Compareplot(ISINGDATA, ptnum=5000, param='odds ratio')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.