-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathctmm_range_occurrence.R
101 lines (82 loc) · 2.79 KB
/
ctmm_range_occurrence.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
###########
# RANGE VERSUS OCCURRENCE DISTRIBUTIONS
# https://doi.org/10.1101/2022.09.29.509951
###########
library(ctmm)
data(buffalo)
projection(buffalo) <- median(buffalo)
DATA <- buffalo$Cilla
load("data/cilla.rda")
FITS <- list("OUF anisotropic"=FIT)
# include Brownian motion models
FITS[["BM"]] <- ctmm.fit(DATA,ctmm(tau=Inf,isotropic=TRUE))
# this one is not as commonly used, but let's throw it in
FITS[["BM anisotropic"]] <- ctmm.fit(DATA,ctmm(tau=Inf))
# you can't compare stationary (IID,OU,OUF) and conditionally stationary (BM,IOU) models with likelihood
summary(FITS)
# but you can compare within
summary(FITS[c("BM","BM anisotropic")])
SVF <- variogram(DATA,CI="Gauss")
# again, the selected model looks okay
zoom(SVF,FITS[[1]])
# the Brownian motion model looks...
zoom(SVF,FITS$BM)
# why? zoom in
# range distribution - using the selected model
RD <- akde(DATA,FITS[[1]])
# occurrence distribution - using the selected model
OD <- occurrence(DATA,FITS[[1]])
# conventional (non-dynamic) Brownian bridge
BB <- occurrence(DATA,FITS$BM)
# plot them
EXT <- extent(list(DATA,OD,RD))
plot(RD,col.level=NA,col.grid=NA,ext=EXT)
title("OUF AKDE")
# plot OUF occurrence distribution
plot(OD,col.level=NA,ext=EXT)
title("OUF Krige")
# plot BM occurrence distribution (BB)
plot(BB,col.level=NA,ext=EXT)
title("BM Krige (BB)")
# Q: What is the occurrence distribution?
# A: Given a random time *in the sampling period*, where was the animal
# Q: What is the range distribution?
# A: At some time in the future/past *under the same behaviors* where will the animal be
# A: Long-term space use *for continuing behaviors*
# Impact of coarsening the data
SUB <- DATA
#########################
# remove every other time
#########################
SUB <- SUB[as.logical(1:nrow(SUB)%%2),]
par(mfrow=c(1,2))
RD <- akde(SUB,FITS[[1]])
OD <- occurrence(SUB,FITS[[1]])
plot(RD,col.level=NA,col.grid=NA,ext=EXT)
title("Range distribution")
plot(OD,col.level=NA,ext=EXT)
title("Occurrence distribution")
#########################
# repeat the above until they look similar
# how much data when they look similar?
nrow(DATA)
nrow(SUB)
# Impact of truncating the data
SUB <- DATA
####################################
# remove the second half of the data
####################################
SUB <- SUB[1:round(nrow(SUB)/2),]
par(mfrow=c(1,2))
RD <- akde(SUB,FITS[[1]])
OD <- occurrence(SUB,FITS[[1]])
plot(RD,col.level=NA,col.grid=NA,ext=EXT)
title("Range distribution")
plot(OD,col.level=NA,ext=EXT)
title("Occurrence distribution")
####################################
# repeat the above
par(mfrow=c(1,1))
# range area = predicted space use, given the same behaviors (biological)
# occurrence area = uncertainty (sampling dependent and limited to the sampling period)
# neither estimate the amount of space used during the sampling period!!!