#2.S.7 Twenty patients with severe epilepsy were observed for 8 weeks. The following are the numbers of major seizures suffered by each patient during the observation period: 5 0 9 6 0 0 5 0 6 1 5 0 0 0 0 7 0 0 4 7 #(a) Is the distribution of seizures bimodal? Justify your answer. #(b) Calculate the SD of seizures. #(c) What percentage of the seizures is within 1 SD of the mean? #(d) What percentage of the seizures is within 2 SDs of the mean?
seizure <- c(5,0,9,6,0,0,5,0,6,1,5,0,0,0,0,7,0,0,4,7)
#(a) Is the distribution of seizures bimodal? Justify your answer.
hist(seizure)
#yes the distribution appears bimodal with two peaks at bin 1 and 3
#(c) What percentage of the seizures is within 1 SD of the mean?
mean.seizure <-mean(seizure) # calculates mean seizures
sd.seizure <- sd(seizure) # calc sd for seizures
##(c) What percentage of the seizures are within 1 SD of the mean?
sum(seizure>mean.seizure-sd.seizure & seizure < mean.seizure+sd.seizure)/length(seizure)*100
## [1] 75
#(d) What percentage of the seizures is within 2 SDs of the mean?
sum(seizure>mean.seizure-2*sd.seizure) & seizure < mean.seizure+2*sd.seizure/length(seizure)*100
## [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
## [16] TRUE TRUE TRUE TRUE TRUE