google maps - Catastrophe Modeling with Longitude/Latitude coordinates in R -


i've got pretty interesting question that's giving me tough time. work insurance company, , we're trying model our exposure in event of terrorist attack.

here's sample data:

df <- data.frame(long=c(-74.01, -73.86, -77.61, -73.99),              lat=c(40.71,40.94,43.16,40.69),              limit=c(10,20,30,40)) 

hypothetical example: terrorist explodes bomb @ 1 of our members @ coordinates (long=-74.01, lat=40.71). if don't example, pretend it's natural disaster instead. i'm curious know our entire book's exposure is. if bomb causes $10 million in damage @ 1 location, how damage cause @ our other locations?

essentially, want function in can type name of city or landmark or pair of coordinates (like geocode function in ggmap , dismo), , determine our company's exposure. type in longitude -75, latitude 40, , bomb or catastrophic event of magnitude, , function spits out range of possible losses our company suffer.

i hope makes sense. help.

here's 1 way think trying do.

d <- data.frame(long=c(-74.01, -73.86, -77.61, -73.99),                 lat=c(40.71, 40.94, 43.16, 40.69),                 limit=c(10, 20, 30, 40))  library(sp) # coerce d spatialpointsdataframe ease of distance calculation coordinates(d) <- ~long+lat  claim <- function(long, lat, damage, member_db) {   require(sp) # spdistsn1   dist_miles <- spdistsn1(member_db, c(long, lat), longlat=true) * 0.62137   # great circle distance in kilometres, converted miles   pmin(member_db$limit, damage^(1/(2^dist_miles)))   # return member limit, or damage, whichever lower }  claim(-75, 40, 15, d) ## [1] 1 1 1 1  claim(-74.01, 40.71, 15, d) ## [1] 10.000000  1.000013  1.000000  2.258128 

note choice of function, i.e. cost = damage^(1/2^distance), means minimum cost per member 1, since damage^0 equals 1. (this seems costly insurer!)


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -