Skip to content

Instantly share code, notes, and snippets.

View dsjohnson's full-sized avatar

Devin Johnson dsjohnson

  • NOAA Pacific Islands Fisheries Science Center
  • Loveland, CO
  • 21:32 (UTC -06:00)
View GitHub Profile
@dsjohnson
dsjohnson / run_nfs_analysis_pop_INLA.R
Created December 11, 2013 21:26
Fur seal analysis from Devin S. Johnson, Mevin B. Hooten, and Carey E. Kuhn (2013) Estimating animal resource selection from telemetry data using point process models. Journal of Animal Ecology 82:1155--1164.
library(sp)
library(rgdal)
library(RColorBrewer)
library(spdep)
library(INLA)
library(grid)
library(gridExtra)
Greys <- colorRampPalette(brewer.pal(9,"Greys"))
#source("stpp_rsf_helper.R")
load("nfs_analysis/JAE_analysis_data_spatial.RData")
@dsjohnson
dsjohnson / stpp_rsf_helper.R
Created December 11, 2013 21:17
Helper functions for analyzing animal telemetry data with point process models from Devin S. Johnson, Mevin B. Hooten, and Carey E. Kuhn (2013) Estimating animal resource selection from telemetry data using point process models. Journal of Animal Ecology 82:1155--1164.
## Spatio-temporal point process RSF helper functions
###
### Create spatial polygons object from a SpatialPoints object
###
voronoiPoly <- function(layer){
require(deldir)
require(sp)
crds <- layer@coords
z <- deldir(crds[,1], crds[,2], rw=as.vector(t(bbox(layer))))