Epilepsy, one hears people having seizures because of it, but no one really knows the severity of it unless you are the one who has it or know someone that has it. This data consist 59 random patients with epilepsy who were randomly given two different anti-epilepsy drugs. These 59 patients were observed 8 weeks prior to receiving treatment, and observed for 8 weeks while receiving treatment. Of the 59 patients 31 were given Progabide, and 28 received placebo. The questions is: What treatment is better the Progabide or the placebo? In order to do this two separate data sets have to be created one with patients that received the Progabide and one with patients that received the placebo.
dframeep <- read.csv("https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/robustbase/epilepsy.csv",stringsAsFactors = FALSE)
colnames(dframeep) <- c("X","ID","Y1","Y2","Y3","Y4","Base","Age","Trt","YSum","Age10","Base4")
str(dframeep)
## 'data.frame': 59 obs. of 12 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ ID : int 104 106 107 114 116 118 123 126 130 135 ...
## $ Y1 : int 5 3 2 4 7 5 6 40 5 14 ...
## $ Y2 : int 3 5 4 4 18 2 4 20 6 13 ...
## $ Y3 : int 3 3 0 1 9 8 0 23 6 6 ...
## $ Y4 : int 3 3 5 4 21 7 2 12 5 0 ...
## $ Base : int 11 11 6 8 66 27 12 52 23 10 ...
## $ Age : int 31 30 25 36 22 29 31 42 37 28 ...
## $ Trt : chr "placebo" "placebo" "placebo" "placebo" ...
## $ YSum : int 14 14 11 13 55 22 12 95 22 33 ...
## $ Age10: num 3.1 3 2.5 3.6 2.2 2.9 3.1 4.2 3.7 2.8 ...
## $ Base4: num 2.75 2.75 1.5 2 16.5 6.75 3 13 5.75 2.5 ...
dim(dframeep)
## [1] 59 12
names(dframeep)
## [1] "X" "ID" "Y1" "Y2" "Y3" "Y4" "Base" "Age"
## [9] "Trt" "YSum" "Age10" "Base4"
attributes(dframeep)
## $names
## [1] "X" "ID" "Y1" "Y2" "Y3" "Y4" "Base" "Age"
## [9] "Trt" "YSum" "Age10" "Base4"
##
## $class
## [1] "data.frame"
##
## $row.names
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
## [47] 47 48 49 50 51 52 53 54 55 56 57 58 59
(10 random patients will be selected)
dfplacebo<- dframeep [c(1:28),c(1,2,7,8,10)]
dfplacebo
## X ID Base Age YSum
## 1 1 104 11 31 14
## 2 2 106 11 30 14
## 3 3 107 6 25 11
## 4 4 114 8 36 13
## 5 5 116 66 22 55
## 6 6 118 27 29 22
## 7 7 123 12 31 12
## 8 8 126 52 42 95
## 9 9 130 23 37 22
## 10 10 135 10 28 33
## 11 11 141 52 36 66
## 12 12 145 33 24 30
## 13 13 201 18 23 16
## 14 14 202 42 36 42
## 15 15 205 87 26 59
## 16 16 206 50 26 16
## 17 17 210 18 28 6
## 18 18 213 111 31 123
## 19 19 215 18 32 15
## 20 20 217 20 21 16
## 21 21 219 12 29 14
## 22 22 220 9 21 14
## 23 23 222 17 32 13
## 24 24 226 28 25 30
## 25 25 227 55 30 143
## 26 26 230 9 40 6
## 27 27 234 10 19 10
## 28 28 238 47 22 53
colnames(dfplacebo)<-c("X","Patient#","NumofAttacksBeforeTreatment","Age","NumofAttacksDuringTreatment")
dfplacebo
## X Patient# NumofAttacksBeforeTreatment Age NumofAttacksDuringTreatment
## 1 1 104 11 31 14
## 2 2 106 11 30 14
## 3 3 107 6 25 11
## 4 4 114 8 36 13
## 5 5 116 66 22 55
## 6 6 118 27 29 22
## 7 7 123 12 31 12
## 8 8 126 52 42 95
## 9 9 130 23 37 22
## 10 10 135 10 28 33
## 11 11 141 52 36 66
## 12 12 145 33 24 30
## 13 13 201 18 23 16
## 14 14 202 42 36 42
## 15 15 205 87 26 59
## 16 16 206 50 26 16
## 17 17 210 18 28 6
## 18 18 213 111 31 123
## 19 19 215 18 32 15
## 20 20 217 20 21 16
## 21 21 219 12 29 14
## 22 22 220 9 21 14
## 23 23 222 17 32 13
## 24 24 226 28 25 30
## 25 25 227 55 30 143
## 26 26 230 9 40 6
## 27 27 234 10 19 10
## 28 28 238 47 22 53
summary(dfplacebo)
## X Patient# NumofAttacksBeforeTreatment
## Min. : 1.00 Min. :104.0 Min. : 6.00
## 1st Qu.: 7.75 1st Qu.:125.2 1st Qu.: 11.00
## Median :14.50 Median :203.5 Median : 19.00
## Mean :14.50 Mean :176.8 Mean : 30.79
## 3rd Qu.:21.25 3rd Qu.:219.2 3rd Qu.: 47.75
## Max. :28.00 Max. :238.0 Max. :111.00
## Age NumofAttacksDuringTreatment
## Min. :19.00 Min. : 6.00
## 1st Qu.:24.75 1st Qu.: 13.75
## Median :29.00 Median : 16.00
## Mean :29.00 Mean : 34.39
## 3rd Qu.:32.00 3rd Qu.: 44.75
## Max. :42.00 Max. :143.00
dim(dfplacebo)
## [1] 28 5
names(dfplacebo)
## [1] "X" "Patient#"
## [3] "NumofAttacksBeforeTreatment" "Age"
## [5] "NumofAttacksDuringTreatment"
attributes(dfplacebo)
## $names
## [1] "X" "Patient#"
## [3] "NumofAttacksBeforeTreatment" "Age"
## [5] "NumofAttacksDuringTreatment"
##
## $row.names
## [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## [24] 24 25 26 27 28
##
## $class
## [1] "data.frame"
Number of Attacks Before Treatment
mean(dfplacebo$`NumofAttacksBeforeTreatment`)
## [1] 30.78571
median(dfplacebo$`NumofAttacksBeforeTreatment`)
## [1] 19
quantile(dfplacebo$`NumofAttacksBeforeTreatment`)
## 0% 25% 50% 75% 100%
## 6.00 11.00 19.00 47.75 111.00
Number Attacks During Treament
mean(dfplacebo$`NumofAttacksDuringTreatment`)
## [1] 34.39286
median(dfplacebo$`NumofAttacksDuringTreatment`)
## [1] 16
quantile(dfplacebo$`NumofAttacksDuringTreatment`)
## 0% 25% 50% 75% 100%
## 6.00 13.75 16.00 44.75 143.00
hist(dfplacebo$`NumofAttacksBeforeTreatment`)
hist(dfplacebo$`NumofAttacksDuringTreatment`)
plot(density(dfplacebo$`NumofAttacksBeforeTreatment`))
plot(density(dfplacebo$`NumofAttacksDuringTreatment`))
plot(dfplacebo)
require(ggplot2)
## Loading required package: ggplot2
qplot(seq_along(dfplacebo$Age),(dfplacebo$`NumofAttacksDuringTreatment`))
ggplot(dfplacebo,aes(x=Age, y=NumofAttacksDuringTreatment)) + geom_line()
dfprogabide <- dframeep [c(29:59), c(1,2,7,8,10)]
dfprogabide
## X ID Base Age YSum
## 29 29 101 76 18 42
## 30 30 102 38 32 28
## 31 31 103 19 20 7
## 32 32 108 10 30 13
## 33 33 110 19 18 19
## 34 34 111 24 24 11
## 35 35 112 31 30 74
## 36 36 113 14 35 20
## 37 37 117 11 27 10
## 38 38 121 67 20 24
## 39 39 122 41 22 29
## 40 40 124 7 28 4
## 41 41 128 22 23 6
## 42 42 129 13 40 12
## 43 43 137 46 33 65
## 44 44 139 36 21 26
## 45 45 143 38 35 39
## 46 46 147 7 25 7
## 47 47 203 36 26 32
## 48 48 204 11 25 3
## 49 49 207 151 22 302
## 50 50 208 22 32 13
## 51 51 209 41 25 26
## 52 52 211 32 35 10
## 53 53 214 56 21 70
## 54 54 218 24 41 13
## 55 55 221 16 32 15
## 56 56 225 22 26 51
## 57 57 228 25 21 6
## 58 58 232 13 36 0
## 59 59 236 12 37 10
colnames(dfprogabide)<-c("X","Patient#","NumofAttacksBeforeTreatment", "Age","NumofAttacksDuringTreatment")
dfprogabide
## X Patient# NumofAttacksBeforeTreatment Age NumofAttacksDuringTreatment
## 29 29 101 76 18 42
## 30 30 102 38 32 28
## 31 31 103 19 20 7
## 32 32 108 10 30 13
## 33 33 110 19 18 19
## 34 34 111 24 24 11
## 35 35 112 31 30 74
## 36 36 113 14 35 20
## 37 37 117 11 27 10
## 38 38 121 67 20 24
## 39 39 122 41 22 29
## 40 40 124 7 28 4
## 41 41 128 22 23 6
## 42 42 129 13 40 12
## 43 43 137 46 33 65
## 44 44 139 36 21 26
## 45 45 143 38 35 39
## 46 46 147 7 25 7
## 47 47 203 36 26 32
## 48 48 204 11 25 3
## 49 49 207 151 22 302
## 50 50 208 22 32 13
## 51 51 209 41 25 26
## 52 52 211 32 35 10
## 53 53 214 56 21 70
## 54 54 218 24 41 13
## 55 55 221 16 32 15
## 56 56 225 22 26 51
## 57 57 228 25 21 6
## 58 58 232 13 36 0
## 59 59 236 12 37 10
summary(dfprogabide)
## X Patient# NumofAttacksBeforeTreatment
## Min. :29.0 Min. :101.0 Min. : 7.00
## 1st Qu.:36.5 1st Qu.:115.0 1st Qu.: 13.50
## Median :44.0 Median :139.0 Median : 24.00
## Mean :44.0 Mean :160.7 Mean : 31.61
## 3rd Qu.:51.5 3rd Qu.:210.0 3rd Qu.: 38.00
## Max. :59.0 Max. :236.0 Max. :151.00
## Age NumofAttacksDuringTreatment
## Min. :18.00 Min. : 0.00
## 1st Qu.:22.00 1st Qu.: 10.00
## Median :26.00 Median : 15.00
## Mean :27.74 Mean : 31.84
## 3rd Qu.:32.50 3rd Qu.: 30.50
## Max. :41.00 Max. :302.00
dim(dfprogabide)
## [1] 31 5
names(dfprogabide)
## [1] "X" "Patient#"
## [3] "NumofAttacksBeforeTreatment" "Age"
## [5] "NumofAttacksDuringTreatment"
attributes(dfprogabide)
## $names
## [1] "X" "Patient#"
## [3] "NumofAttacksBeforeTreatment" "Age"
## [5] "NumofAttacksDuringTreatment"
##
## $row.names
## [1] 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
## [24] 52 53 54 55 56 57 58 59
##
## $class
## [1] "data.frame"
Number of Attacks Before Treatment
mean(dfprogabide$`NumofAttacksBeforeTreatment`)
## [1] 31.6129
median(dfprogabide$`NumofAttacksBeforeTreatment`)
## [1] 24
quantile(dfprogabide$`NumofAttacksBeforeTreatment`)
## 0% 25% 50% 75% 100%
## 7.0 13.5 24.0 38.0 151.0
Number Attacks During Treatment
mean(dfprogabide$`NumofAttacksDuringTreatment`)
## [1] 31.83871
median(dfprogabide$`NumofAttacksDuringTreatment`)
## [1] 15
quantile(dfprogabide$`NumofAttacksDuringTreatment`)
## 0% 25% 50% 75% 100%
## 0.0 10.0 15.0 30.5 302.0
hist(dfprogabide$`NumofAttacksBeforeTreatment`)
hist(dfprogabide$`NumofAttacksDuringTreatment`)
plot(density(dfprogabide$`NumofAttacksBeforeTreatment`))
plot(density(dfprogabide$`NumofAttacksDuringTreatment`))
plot(dfprogabide)
require(ggplot2)
qplot(seq_along(dfprogabide$Age),(dfprogabide$`NumofAttacksDuringTreatment`))
ggplot(dfprogabide, aes(x= Age,y=NumofAttacksDuringTreatment)) + geom_line()
plot(density(dfplacebo$`NumofAttacksDuringTreatment`))
plot(density(dfprogabide$`NumofAttacksDuringTreatment`))
With the given data Im not really sure if any of the treatments works, just looking at the mean comparisons they both increased. There was a minimum increase in the progabide but for one of the patients the number of attacks doubled. Before treatment Patient 49 had 152 attacks and during treatment it went up too 302 attacks. For the treatment for the placebo Patient 25 had 55 attacks before the treatment and it went up to 143 attacks during the treatment. It is hard to figure out if any of the treatments are better. There was another patient that had 0 attacks during treatment with the progabide. The results seem very inconclusive a treatment may work for one person but it may not work for another. The only thing that seems conclusive is that the majority of attacks happened to people that were in their 20’s and early 30’s.
dframeepi <- read.csv("https://raw.githubusercontent.com/Luz917/epilepsyinfo/master/epilepsy.csv.txt",
stringsAsFactors = FALSE)
colnames(dframeepi) <- c("X","ID","Y1","Y2","Y3","Y4","Base","Age","Trt","YSum","Age10","Base4")
str(dframeepi)
## 'data.frame': 59 obs. of 12 variables:
## $ X : int 1 2 3 4 5 6 7 8 9 10 ...
## $ ID : int 104 106 107 114 116 118 123 126 130 135 ...
## $ Y1 : int 5 3 2 4 7 5 6 40 5 14 ...
## $ Y2 : int 3 5 4 4 18 2 4 20 6 13 ...
## $ Y3 : int 3 3 0 1 9 8 0 23 6 6 ...
## $ Y4 : int 3 3 5 4 21 7 2 12 5 0 ...
## $ Base : int 11 11 6 8 66 27 12 52 23 10 ...
## $ Age : int 31 30 25 36 22 29 31 42 37 28 ...
## $ Trt : chr "placebo" "placebo" "placebo" "placebo" ...
## $ YSum : int 14 14 11 13 55 22 12 95 22 33 ...
## $ Age10: num 3.1 3 2.5 3.6 2.2 2.9 3.1 4.2 3.7 2.8 ...
## $ Base4: num 2.75 2.75 1.5 2 16.5 6.75 3 13 5.75 2.5 ...