The optimize-surface
script attempts to determine unobserved allocation parameters by optimization.
In [1]:
include("../src/optimize-surface.jl")
In [2]:
recorded = readtable("../data/extraction/USGS-2010.csv");
In [3]:
using RCall
R"library(ggplot2)"
R"library(PBSmapping)"
R"shapes <- importShapefile('../data/mapping/US_county_2000-simple')"
R"polydata <- attributes(shapes)$PolyData"
R"polydata$STATE <- as.numeric(levels(polydata$STATE))[polydata$STATE]"
R"polydata$COUNTY <- as.numeric(levels(polydata$COUNTY))[polydata$COUNTY]"
R"shapes$id <- polydata$STATE[shapes$PID] * 100 + polydata$COUNTY[shapes$PID] / 10";
R"names(shapes) <- tolower(names(shapes))";
In [24]:
recorded[:supersource] = sol.sol[1:varlens[1]]
R"ggplot($recorded, aes(fill=supersource)) + geom_map(aes(map_id=FIPS), map=shapes) +
expand_limits(x=c(-2500000, 2500000), y=c(-1.4e6, 1.6e6)) +
scale_fill_gradient(name='Supersource', trans='log', low='white', high='#132B43', breaks=c(1, 10, 1e3, 1e4, 1e5, 1e6)) +
theme_bw() + theme(legend.justification=c(0,0), legend.position=c(0,0)) + xlab('') + ylab('')"
Out[24]:
In [ ]: