lomidas1 <- read.table("C:/Users/User/Desktop/Mahidol-Oxford Bangkok/Abiamalaria.csv",sep = ",", strip.white = T, header = T)
summary(lomidas1)
## Region..Province Year Month mmyyyy
## ab Abia State:40 Min. :2013 August : 4 Apr-14 : 1
## 1st Qu.:2014 July : 4 Apr-15 : 1
## Median :2015 June : 4 Apr-16 : 1
## Mean :2015 September: 4 Aug-13 : 1
## 3rd Qu.:2015 April : 3 Aug-14 : 1
## Max. :2016 December : 3 Aug-15 : 1
## (Other) :18 (Other):34
## Popn.at.risk.of.malaria All.cause.outpatient.cases
## Min. :3415016 Min. : 117
## 1st Qu.:3507222 1st Qu.: 9473
## Median :3601917 Median :12156
## Mean :3540801 Mean :11643
## 3rd Qu.:3601917 3rd Qu.:15910
## Max. :3601917 Max. :27579
## NA's :3
## All.cause.inpatient.cases All.cause.deaths
## Min. : 1 Mode:logical
## 1st Qu.: 628 NA's:40
## Median : 1108
## Mean : 7391
## 3rd Qu.: 1417
## Max. :223643
## NA's :4
## Suspected.cases..suspected.malaria. Tested.cases..Mic..RDT.
## Min. : 138 Min. : 0.0
## 1st Qu.: 5224 1st Qu.: 737.8
## Median : 6873 Median : 4264.5
## Mean : 7322 Mean : 4181.1
## 3rd Qu.:10345 3rd Qu.: 6607.0
## Max. :16571 Max. :11069.0
## NA's :4 NA's :2
## Positive.malaria.cases..Mic..RDT. No..of.inpatient.malaria.cases
## Min. : 0.0 Min. : 3.0
## 1st Qu.: 942.2 1st Qu.: 70.0
## Median :3266.5 Median :116.0
## Mean :3236.0 Mean :135.1
## 3rd Qu.:5283.8 3rd Qu.:182.0
## Max. :8080.0 Max. :331.0
## NA's :2 NA's :7
## Total.malaria.cases No..malaria.deaths No..clinical.malaria.cases
## Min. : 0 Min. : 1.00 Min. : 8
## 1st Qu.: 2932 1st Qu.: 1.00 1st Qu.:2290
## Median : 6767 Median : 2.00 Median :3680
## Mean : 6764 Mean : 4.50 Mean :3883
## 3rd Qu.:10171 3rd Qu.: 2.75 3rd Qu.:5881
## Max. :15637 Max. :18.00 Max. :8925
## NA's :2 NA's :28 NA's :3
## No...of.patients.tested.for.malaria.using.an.RDT
## Min. : 20
## 1st Qu.:1876
## Median :4069
## Mean :4195
## 3rd Qu.:6332
## Max. :9803
## NA's :4
## No..of.patients.tested.for.malaria.using.microscopy
## Min. : 15.0
## 1st Qu.: 257.0
## Median : 468.5
## Mean : 493.3
## 3rd Qu.: 637.0
## Max. :1266.0
## NA's :4
## No...of.patients.tested.positive.for.malaria.using.an.RDT
## Min. : 20
## 1st Qu.:1524
## Median :2994
## Mean :3063
## 3rd Qu.:4616
## Max. :6876
## NA's :4
## No.of.patients.tested.positive.for.malaria.using.microscopy
## Min. : 12.0
## 1st Qu.: 251.0
## Median : 416.5
## Mean : 463.1
## 3rd Qu.: 621.5
## Max. :1204.0
## NA's :4
## No..of.LLINs.distributed
## Min. : 0
## 1st Qu.: 259
## Median : 745
## Mean :1228
## 3rd Qu.:1410
## Max. :5339
## NA's :3
monthmmyyyyPopn.at.risk.of.malaria<-aggregate(Popn.at.risk.of.malaria~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyPopn.at.risk.of.malaria)
## Month mmyyyy Popn.at.risk.of.malaria
## 1 April Apr-14 3507222
## 2 April Apr-15 3601917
## 3 April Apr-16 3601917
## 4 August Aug-13 3415016
## 5 August Aug-14 3507222
## 6 August Aug-15 3601917
ts.Pop.Avg<-ts(monthmmyyyyPopn.at.risk.of.malaria$Popn.at.risk.of.malaria,start=c(2013, 1), end=c(2016, 12), frequency=12)
plot(ts.Pop.Avg,main="Abia State.Malaria.Population at risk",col="red",ylab="Popn.at.risk.of.malaria(aggregate)")
monthmmyyyyNo..of.LLINs.distributed<-aggregate(No..of.LLINs.distributed~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyNo..of.LLINs.distributed)
## Month mmyyyy No..of.LLINs.distributed
## 1 April Apr-14 4956
## 2 April Apr-15 1632
## 3 April Apr-16 704
## 4 August Aug-13 9
## 5 August Aug-14 3032
## 6 August Aug-15 1141
ts.Pop.Avg<-ts(monthmmyyyyNo..of.LLINs.distributed$No..of.LLINs.distributed,start=c(2013, 1), end=c(2016, 12), frequency=12)
plot(ts.Pop.Avg,main="Abia.No..of.LLINs.distributed",col="red",ylab="No..of.LLINs.distributed(aggregate)")
monthmmyyyyAll.cause.outpatient.cases<-aggregate(All.cause.outpatient.cases~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyAll.cause.outpatient.cases )
## Month mmyyyy All.cause.outpatient.cases
## 1 April Apr-14 17562
## 2 April Apr-15 15240
## 3 April Apr-16 11148
## 4 August Aug-13 504
## 5 August Aug-14 17880
## 6 August Aug-15 16233
ts.Pop.Avg<-ts(monthmmyyyyAll.cause.outpatient.cases$All.cause.outpatient.cases,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Malaria.Population at risk", col="red",ylab="All.cause.outpatient.cases(aggregate)")
#Plots of All.cause.inpatient.cases
lomidas1[ , 4]<-as.character(lomidas1[ , 4])
##for(i in 4:numMalaria + 1){lomidas1[ , i] <- as.numeric(lomidas1[ , i])}
lomidas1$mmyyyy <- sapply(lomidas1$mmyyyy,
function(month)paste("01-",month, sep=""))
lomidas1$mmyyyy <- as.Date(lomidas1$mmyyyy,"%d-%b-%y")
head(lomidas1)
## Region..Province Year Month mmyyyy Popn.at.risk.of.malaria
## 1 ab Abia State 2013 June 2013-06-01 3415016
## 2 ab Abia State 2013 July 2013-07-01 3415016
## 3 ab Abia State 2013 August 2013-08-01 3415016
## 4 ab Abia State 2013 September 2013-09-01 3415016
## 5 ab Abia State 2013 October 2013-10-01 3415016
## 6 ab Abia State 2013 November 2013-11-01 3415016
## All.cause.outpatient.cases All.cause.inpatient.cases All.cause.deaths
## 1 168 3 NA
## 2 565 NA NA
## 3 504 1 NA
## 4 1910 4 NA
## 5 1646 13 NA
## 6 3207 37 NA
## Suspected.cases..suspected.malaria. Tested.cases..Mic..RDT.
## 1 138 37
## 2 274 141
## 3 299 168
## 4 515 361
## 5 981 628
## 6 2323 1067
## Positive.malaria.cases..Mic..RDT. No..of.inpatient.malaria.cases
## 1 32 NA
## 2 104 10
## 3 158 NA
## 4 322 NA
## 5 636 3
## 6 662 4
## Total.malaria.cases No..malaria.deaths No..clinical.malaria.cases
## 1 122 NA 90
## 2 245 NA 141
## 3 419 NA 261
## 4 657 NA 335
## 5 1079 NA 443
## 6 2164 NA 1502
## No...of.patients.tested.for.malaria.using.an.RDT
## 1 20
## 2 122
## 3 121
## 4 128
## 5 371
## 6 810
## No..of.patients.tested.for.malaria.using.microscopy
## 1 17
## 2 19
## 3 47
## 4 233
## 5 257
## 6 257
## No...of.patients.tested.positive.for.malaria.using.an.RDT
## 1 20
## 2 85
## 3 111
## 4 108
## 5 383
## 6 417
## No.of.patients.tested.positive.for.malaria.using.microscopy
## 1 12
## 2 19
## 3 47
## 4 214
## 5 253
## 6 245
## No..of.LLINs.distributed
## 1 14
## 2 2
## 3 9
## 4 19
## 5 7
## 6 114
plot(lomidas1$All.cause.inpatient.cases~lomidas1$mmyyyy,
type="l",
lwd=2,
col="red",
xlab="Time", ylab="All cause inpatient cases",
main="Abia All cause inpatient cases")
monthmmyyyyTested.cases..Mic..RDT.<-aggregate(Tested.cases..Mic..RDT.~Month+mmyyyy, data=lomidas1, FUN=mean)
head(monthmmyyyyTested.cases..Mic..RDT.)
## Month mmyyyy Tested.cases..Mic..RDT.
## 1 June 2013-06-01 37
## 2 July 2013-07-01 141
## 3 August 2013-08-01 168
## 4 September 2013-09-01 361
## 5 October 2013-10-01 628
## 6 November 2013-11-01 1067
ts.Pop.Avg<-ts(monthmmyyyyTested.cases..Mic..RDT.$Tested.cases..Mic..RDT.,start=c(2013, 1), end=c(2016, 12), frequency=12)
plot(ts.Pop.Avg,main="Abia.Tested.cases..Mic..RDT.", col="red",ylab="Tested.cases..Mic..RDT.(aggregate)")
monthmmyyyyPositive.malaria.cases..Mic..RDT.<-aggregate( Positive.malaria.cases..Mic..RDT.~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyPositive.malaria.cases..Mic..RDT.)
## Month mmyyyy Positive.malaria.cases..Mic..RDT.
## 1 June 2013-06-01 32
## 2 July 2013-07-01 104
## 3 August 2013-08-01 158
## 4 September 2013-09-01 322
## 5 October 2013-10-01 636
## 6 November 2013-11-01 662
ts.Pop.Avg<-ts(monthmmyyyyPositive.malaria.cases..Mic..RDT.$ Positive.malaria.cases..Mic..RDT.,start=c(2013, 1),end=c(2016, 12), frequency=12)
plot(ts.Pop.Avg,main="Abia. Positive.malaria.cases..Mic..RDT.", col="red",ylab=" Positive.malaria.cases..Mic..RDT.(aggregate)")
monthmmyyyyNo..of.inpatient.malaria.cases<-aggregate(No..of.inpatient.malaria.cases~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyNo..of.inpatient.malaria.cases)
## Month mmyyyy No..of.inpatient.malaria.cases
## 1 July 2013-07-01 10
## 2 October 2013-10-01 3
## 3 November 2013-11-01 4
## 4 December 2013-12-01 18
## 5 January 2014-01-01 70
## 6 February 2014-02-01 54
ts.Pop.Avg<-ts(monthmmyyyyNo..of.inpatient.malaria.cases$No..of.inpatient.malaria.cases,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.No..of.inpatient.malaria.cases", col="red",ylab="No..of.inpatient.malaria.cases(aggregate)")
monthmmyyyyTotal.malaria.cases<-aggregate(Total.malaria.cases~Month+mmyyyy,
data=lomidas1, FUN=mean)
head(monthmmyyyyTotal.malaria.cases)
## Month mmyyyy Total.malaria.cases
## 1 June 2013-06-01 122
## 2 July 2013-07-01 245
## 3 August 2013-08-01 419
## 4 September 2013-09-01 657
## 5 October 2013-10-01 1079
## 6 November 2013-11-01 2164
ts.Pop.Avg<-ts(monthmmyyyyTotal.malaria.cases$Total.malaria.cases,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.Total.malaria.cases",col="red",ylab="Total.malaria.cases(aggregate)")
monthmmyyyyNo..malaria.deaths<-aggregate(No..malaria.deaths~Month+mmyyyy,
data=lomidas1, FUN=mean)
head(monthmmyyyyNo..malaria.deaths)
## Month mmyyyy No..malaria.deaths
## 1 January 2014-01-01 5
## 2 May 2014-05-01 2
## 3 June 2014-06-01 1
## 4 July 2014-07-01 2
## 5 September 2014-09-01 1
## 6 October 2014-10-01 1
ts.Pop.Avg<-ts(monthmmyyyyNo..malaria.deaths$No..malaria.deaths,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.No..malaria.deaths", col="red",ylab="No..malaria.deaths(aggregate)")
monthmmyyyyNo..clinical.malaria.cases <-aggregate(No..clinical.malaria.cases ~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyNo..clinical.malaria.cases)
## Month mmyyyy No..clinical.malaria.cases
## 1 June 2013-06-01 90
## 2 July 2013-07-01 141
## 3 August 2013-08-01 261
## 4 September 2013-09-01 335
## 5 October 2013-10-01 443
## 6 November 2013-11-01 1502
ts.Pop.Avg<-ts(monthmmyyyyNo..clinical.malaria.cases$No..clinical.malaria.cases,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.No..clinical.malaria.cases", col="red",ylab="No..clinical.malaria.cases(aggregate)")
monthmmyyyyNo...of.patients.tested.for.malaria.using.an.RDT<-aggregate(No...of.patients.tested.for.malaria.using.an.RDT ~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyNo...of.patients.tested.for.malaria.using.an.RDT)
## Month mmyyyy No...of.patients.tested.for.malaria.using.an.RDT
## 1 June 2013-06-01 20
## 2 July 2013-07-01 122
## 3 August 2013-08-01 121
## 4 September 2013-09-01 128
## 5 October 2013-10-01 371
## 6 November 2013-11-01 810
ts.Pop.Avg<-ts(monthmmyyyyNo...of.patients.tested.for.malaria.using.an.RDT$No...of.patients.tested.for.malaria.using.an.RDT,start=c(2013, 1), end=c(2016, 12),
frequency=12)
plot(ts.Pop.Avg,main="Abia.No...of.patients.tested.for.malaria.using.an.RDT", col="red",ylab="No...of.patients.tested.for.malaria.using.an.RDT(aggregate)")
monthmmyyyyNo..of.patients.tested.for.malaria.using.microscopy<-aggregate(No..of.patients.tested.for.malaria.using.microscopy~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyyNo..of.patients.tested.for.malaria.using.microscopy)
## Month mmyyyy No..of.patients.tested.for.malaria.using.microscopy
## 1 June 2013-06-01 17
## 2 July 2013-07-01 19
## 3 August 2013-08-01 47
## 4 September 2013-09-01 233
## 5 October 2013-10-01 257
## 6 November 2013-11-01 257
ts.Pop.Avg<-ts(monthmmyyyyNo..of.patients.tested.for.malaria.using.microscopy$No..of.patients.tested.for.malaria.using.microscopy,start=c(2013, 1), end=c(2016, 12), frequency=12)
plot(ts.Pop.Avg,main="Abia.No..of.patients.tested.for.malaria.using.microscopy", col="red",ylab="No..of.patients.tested.for.malaria.using.microscopy(aggregate)")
monthmmyyyyNo...of.patients.tested.positive.for.malaria.using.an.RDT<-aggregate(No...of.patients.tested.positive.for.malaria.using.an.RDT~Month+mmyyyy, data=lomidas1, FUN=mean)
head(monthmmyyyyNo...of.patients.tested.positive.for.malaria.using.an.RDT)
## Month mmyyyy
## 1 June 2013-06-01
## 2 July 2013-07-01
## 3 August 2013-08-01
## 4 September 2013-09-01
## 5 October 2013-10-01
## 6 November 2013-11-01
## No...of.patients.tested.positive.for.malaria.using.an.RDT
## 1 20
## 2 85
## 3 111
## 4 108
## 5 383
## 6 417
ts.Pop.Avg<-ts(monthmmyyyyNo...of.patients.tested.positive.for.malaria.using.an.RDT$No...of.patients.tested.positive.for.malaria.using.an.RDT,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.No...of.patients.tested.positive.for.malaria.using.an.RDT", col="red",ylab="No...of.patients.tested.positive.for.malaria.using.an.RDT(aggregate)")
monthmmyyyyNo.of.patients.tested.positive.for.malaria.using.microscopy<-aggregate(No.of.patients.tested.positive.for.malaria.using.microscopy~Month+mmyyyy, data=lomidas1, FUN=mean)
head(monthmmyyyyNo.of.patients.tested.positive.for.malaria.using.microscopy)
## Month mmyyyy
## 1 June 2013-06-01
## 2 July 2013-07-01
## 3 August 2013-08-01
## 4 September 2013-09-01
## 5 October 2013-10-01
## 6 November 2013-11-01
## No.of.patients.tested.positive.for.malaria.using.microscopy
## 1 12
## 2 19
## 3 47
## 4 214
## 5 253
## 6 245
ts.Pop.Avg<-ts(monthmmyyyyNo.of.patients.tested.positive.for.malaria.using.microscopy$No.of.patients.tested.positive.for.malaria.using.microscopy,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.No.of.patients.tested.positive.for.malaria.using.microscopy", col="red",ylab="No.of.patients.tested.positive.for.malaria.using.microscopy(aggregate)")
monthmmyyyySuspected.cases..suspected.malaria.<-aggregate(Suspected.cases..suspected.malaria.~Month+mmyyyy,data=lomidas1, FUN=mean)
head(monthmmyyyySuspected.cases..suspected.malaria.)
## Month mmyyyy Suspected.cases..suspected.malaria.
## 1 June 2013-06-01 138
## 2 July 2013-07-01 274
## 3 August 2013-08-01 299
## 4 September 2013-09-01 515
## 5 October 2013-10-01 981
## 6 November 2013-11-01 2323
ts.Pop.Avg<-ts(monthmmyyyySuspected.cases..suspected.malaria.$Suspected.cases..suspected.malaria.,start=c(2013, 1), end=c(2016, 12),frequency=12)
plot(ts.Pop.Avg,main="Abia.Suspected.cases..suspected.malaria.", col="red",ylab="Suspected.cases..suspected.malaria.(aggregate)")
```