## Saturday, December 27, 2014

### FDA Adverse effect mining part 2

In the last 1st part of the blog we have shown how to use FDA data to visualize adverse events for a particular drug and how to use brandnames and ATC group class and visualize it using rCharts pyramid plots.  This section of the blog discusses about how to calculate the some useful statistics of the data and compare the side effects of two same class or off class drugs.  In the last section we didn't consider the outcome tables which indicates patient outcomes like hospitalization, death etc. The codes in the outcomes table are given as two letter codes and information about it can be found on the documentation of the data.  The codes are given in git. For this part we will use run.R , riskratio.R and function.R codes .
function.R has functions to get all the brandnames of a query drug and collects all the adverse events for particular drug. It also has get.Vis() function to plot pyramid plots by two letter outcome. If outcomes are not specified then it used all the data and plots it.
run.R is used to execute those functions with the data which is given below.  The plots are also shown below.
`````` d1<-get.Names("Lipitor")
d2<-get.Names("Crestor")
d1se<-get.SideEffects(d1,"Lipitor")
d2se<-get.SideEffects(d2,"Crestor")
get.Vis(d1se,d2se,75,col=c("blue","red"))
get.Vis(d1se,d2se,75,col=c("blue","red"),out=c("OT","HO"))``````

I am interested in comparing two standard techniques, namely Reporting odds ratio (ROR) and proportional reporting ratio (PRR) on two different datasets. Both methods use the values according to a 2x2  contingency table,

Drug of Interest Other drug
Event of Interest a b
other event c d

Reporting odds ratio equation is given below. The value (a/b) is the number of patients who had the event of interest and have taken the drug of interest (a) divided by the number of patients who had the event when taking any other drug (b). The value (c/d) is the number of patients who have taken the drug of interest but did not have the event of interest (c), divided by the number of people who had any other events, given that they took any other drug (d).

$ror&space;=&space;(a/b)/(c/d)$

The PRR on the other hand can be calculated as follows:

$prr&space;=&space;(a/a+c)/(b/b+d)$

where a/(a + c)  can be thought of as the probability of an event of interest occurring, given the drug of interest was taken and an event occurred whereas , b/( b+ d) can be thought of as the probability that the event of interest occurred, given any other drug was taken and an event occurred.
``````
# Comparing the Risk adverse effect for two types of drugs
# Get the reactions of Crestor which matches Lipitor
d<-d2se[which(d1se\$reaction %in% d2se\$reaction ),]
n<-d[complete.cases(d),]

# Aggregat all the data without considering the outcomes
crestor<-aggregate(count ~ reaction ,data=n, FUN=sum)

# Get the reactions of Lipitor which matches Crestor from the above dataframe
t<-d1se[which(d\$reaction %in% d1se\$reaction),]
lipitor<-aggregate(count ~ reaction ,data=t, FUN=sum)

# compare crestor against Lipitor
r1.prr<-prr(crestor,lipitor)
r1.ror<-ror(crestor,lipitor)
``````
``````
``````

reaction ror
158 Renal failure 12.50
21 Blood cholesterol increased 7.32
25 Blood triglycerides increased 6.06
70 Fibromyalgia 5.78
75 Gastrooesophageal reflux disease 5.78
39 Chronic obstructive pulmonary disease 5.37
37 Chest discomfort 4.95
117 Migraine 4.95
147 Pancreatitis acute 4.95
170 Type 2 diabetes mellitus 4.54

reaction ror
158 Renal failure 12.50
21 Blood cholesterol increased 7.32
25 Blood triglycerides increased 6.06
70 Fibromyalgia 5.78
75 Gastrooesophageal reflux disease 5.78
39 Chronic obstructive pulmonary disease 5.37
37 Chest discomfort 4.95
117 Migraine 4.95
147 Pancreatitis acute 4.95
170 Type 2 diabetes mellitus 4.54

When crestor is compared to lipitor the prr and ror indicates that chances of Renal Failure , Increased Blood cholesterol, Fibromyaglia is more than lipitor, whereas when one takes lipitor there are more chances of abdominal discomfort, Rash, Muscle atrophy and so on.

Table below shows the prr of lipitor against crestor and its adverse reactions .

reaction prr
2 Abdominal discomfort 17.02
156 Rash 9.12
121 Muscle atrophy 6.68
63 Dyspepsia 6.38
19 Balance disorder 6.28
3 Abdominal pain 6.08