diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2015-07-02 22:37:45 -0700 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2015-07-02 22:37:45 -0700 |
| commit | 58ed50d980a1ba240bb50b27c42db0a679f00b43 (patch) | |
| tree | e7f410984ead0c8b2163edbae9d95dae66a7134b /R Scripts/predict-victims-plots.R | |
| parent | 5a76e2393e4f2d89f885ea99c473da840d0cd7db (diff) | |
| parent | 110069d77815a3d62e3526f18b2a34fb79beff1e (diff) | |
| download | criminal_cascades-58ed50d980a1ba240bb50b27c42db0a679f00b43.tar.gz | |
Merge branch 'master' of github.com:Thibauth/criminal_cascades
Diffstat (limited to 'R Scripts/predict-victims-plots.R')
| -rw-r--r-- | R Scripts/predict-victims-plots.R | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/R Scripts/predict-victims-plots.R b/R Scripts/predict-victims-plots.R index 8a93667..553aa89 100644 --- a/R Scripts/predict-victims-plots.R +++ b/R Scripts/predict-victims-plots.R @@ -1,8 +1,8 @@ ##### Plot results -hist(correct_rank3,150,xlim=c(0,vcount(lcc)),col=rgb(0,0,1,1/8), +hist(correct_rank1,150,xlim=c(0,vcount(lcc)),col=rgb(0,0,1,1/8), xlab='Risk Ranking of Victims',main='') hist(correct_rank1,150,xlim=c(0,vcount(lcc)),col=rgb(1,0,1,1/8),add=T) -hist(correct_rank2,150,xlim=c(0,vcount(lcc)),col=rgb(1,0,1,1/8),add=T) +hist(correct_rank2,150,xlim=c(0,vcount(lcc)),col=rgb(0,0,1,1/8),add=T) legend("topright", c("Demographics Model", "Cascade Model"), fill=c(rgb(1,0,1,1/8), rgb(0,0,1,1/8))) @@ -12,9 +12,9 @@ counts = matrix(c(colSums(correct_rank<(vcount(lcc)/1000))*100/nvics, nrow=3, byrow=T) plot(lambdas,counts[1,],log='x',type='l') -correct_rank1 = correct_rank[,length(lambdas)] -correct_rank2 = correct_rank[,1] -correct_rank3 = correct_rank[,which.min(colMeans(correct_rank))] +correct_rank1 = correct_rank[,length(lambdas)] # demographics model +correct_rank2 = correct_rank[,1] # cascade model +correct_rank3 = correct_rank[,which.min(colMeans(correct_rank))] # best combined model counts = matrix(c(sum(correct_rank1<(vcount(lcc)*0.001)), sum(correct_rank1<(vcount(lcc)*0.005)), sum(correct_rank1<(vcount(lcc)*0.01)), @@ -36,6 +36,7 @@ legend("topleft", inset=0.05, c("Demographics Model", "Cascade Model", "Combined Model"), fill=c(rgb(0,0,1,1/2),rgb(1,0,0,1/2),rgb(0,1,0,1/2))) box(which='plot') + par(new=T) counts = counts/(100/nvics) barplot(counts, @@ -59,3 +60,4 @@ legend("bottomright", inset=0.05, c("Demographics Model", "Cascade Model", "Combined Model"), fill=c('red','darkblue','darkgreen')) lines(c(0,vcount(lcc)),c(0,1)) + |
