Last active
December 31, 2015 02:09
-
-
Save dsjohnson/7918771 to your computer and use it in GitHub Desktop.
Individual space-time analysis of fur seal data 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(sp) | |
library(rgdal) | |
library(raster) | |
library(gstat) | |
library(rgeos) | |
library(automap) | |
library(mgcv) | |
source("stpp_rsf_helper.R") | |
load("nfs_analysis/JAE_analysis_data_st.RData") | |
# load("stQuadList_countVersion.RData") | |
# Trial 1 (fit addditive for all covariates) | |
fit1List <- list() | |
id.trip <- unique(tracks.sp@data[,c("Id","id.trip","tripno")]) | |
pb <- txtProgressBar(min = 0, max = length(stQuadList), style = 3) | |
for(i in 1:length(stQuadList)){ | |
if(id.trip[i,1]%in%c("SP1008","SP1022")) next | |
if(id.trip[i,3]>1) next | |
stQuadData <- stQuadList[[i]] | |
stQuadData$stp.dist <- spDistsN1(pts=as.matrix(stQuadData[,c("x","y")]), pt=c(0,0)) | |
fit1 <- stppRSF(response ~ sst + ln.npp + trans.pollock + t*I(stp.dist/1000) + I(bmKern/1000^2), Q.data=stQuadData, maxit=100) | |
fit1List[[i]] <- fit1 | |
names(fit1List)[i] <- id.trip[i,2] | |
setTxtProgressBar(pb, i) | |
} | |
close(pb) | |
summaries <- lapply(fit1List, FUN=summary, disp=1) | |
save(id.trip, tracks.sp, summaries, fit1List, file="JAE_analysis_indiv_results_20120722.RData") | |
# `SP1015-2` | |
# `SP1018-3` | |
# `SP1019-2` | |
# `SP1020-1` *** | |
# `SP1023-1` *** | |
# | |
# image(aug.hab,"trans.pollock") | |
# plot(tracks.sp[tracks.sp@data$id.trip=='SP1020-1',], add=TRUE, pch=16, cex=0.5) | |
# plot(tracks.sp[tracks.sp@data$id.trip=='SP1023-1',], add=TRUE, pch=1, cex=0.5) | |
# | |
# image(aug.hab,"trans.pollock", col=cm.colors(100)) | |
# lines(tracks.sp[tracks.sp@data$tripno==1 & (!tracks.sp@data$Id%in%c("SP1008","SP1022")),], add=TRUE, pch=16, cex=0.5) | |
# plot(ak, add=TRUE, col=gray(0.2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment