From 229bfd65564210b740642f9c431e9c80588b2baf Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sun, 20 Sep 2015 22:20:18 -0400 Subject: some more plotting tweaks --- R Scripts/fit-background.R | 15 ++++++++------- R Scripts/predict-victims-plots.R | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/R Scripts/fit-background.R b/R Scripts/fit-background.R index 506f6e3..06e91c9 100644 --- a/R Scripts/fit-background.R +++ b/R Scripts/fit-background.R @@ -1,13 +1,13 @@ library(igraph) setwd("~/Documents/Violence Cascades/") -load('Raw Data/hyper-lcc.RData') # load data -hyp_lcc = upgrade_graph(hyp_lcc) -vic_ids = which(V(hyp_lcc)$vic==TRUE) -non_vic_ids = which(V(hyp_lcc)$vic==FALSE) +load('Raw Data/lcc.RData') -hist(as.numeric(hyp_lcc_verts$vic.day[vic_ids]),2000,col='lightblue', +vic_days = as.numeric(unlist(lcc_verts[,16:21])) +vic_days = vic_days[!is.na(vic_days)] + +hist(as.numeric(vic_days,2000,col='lightblue', xlab='Day of Study Period',main='Infections During the Study Period') # get infection counts per day @@ -28,7 +28,8 @@ res = nls(formula=fit_form, data=infs, start=list(lambda=3, A=2, phi=4)) co = coef(res); co plot(t) -plot(days,counts,pch=20,cex=0.9,col='#377EB8', +plot(days,counts,pch=20,cex=0.9,col='#1f78b4', xlab='Day',ylab='Number of Infections') -curve(fit(x, lambda=co["lambda"], A=co["A"], phi=co["phi"]), add=TRUE ,lwd=5, col="steelblue") +curve(fit(x, lambda=co["lambda"], A=co["A"], phi=co["phi"]), + add=TRUE ,lwd=5, col="#1b9e77") diff --git a/R Scripts/predict-victims-plots.R b/R Scripts/predict-victims-plots.R index 0e1b669..7196102 100644 --- a/R Scripts/predict-victims-plots.R +++ b/R Scripts/predict-victims-plots.R @@ -44,7 +44,7 @@ mtext(side = 4, line = 3, "Number of Victims Predicted") #### Precision-Recall Curve plot(ecdf(correct_rank1),col=cols[1],lwd=3,main='', - xlab='Ranking',ylab='CDF',xlim=c(0,140000)) + xlab='Ranking',ylab='CDF') plot(ecdf(correct_rank2),col=cols[2],lwd=3,add=T) plot(ecdf(correct_rank3),col=cols[3],lwd=3,add=T) legend("bottomright", inset=0.05, -- cgit v1.2.3-70-g09d2