The estTransition
estimates migratory connectivity
pattern (ψ, transition probabilities) from seasonal movement data.
The estStrength
function estimates the strength of
migratory connectivity from transition probabilities (MC). See the estStrength vignette for more details.
estTransition
- Estimate transition probabilities while
incorporating location and other sampling uncertaintyTo estimate transition probabilities (psi
(ψ)) and
include location uncertainty the following data are needed:
isGL =
TRUE
) or another data source (isGL = FALSE
)isTelemetry =
TRUE/FALSE
)We estimate transition probabilities using bootstrapped data of birds tracked from breeding to non-breeding regions using light-level and GPS geolocation when: 1) GPS location uncertainty was applied to all individuals, 2) GPS and light-level location uncertainty were applied to individuals with those devices and 3) light-level location uncertainty was applied to all individuals (Cohen et al. 2018).
Load location data that accompanies the MigConnectivity
package. The location data are data from breeding Ovenbirds that were
fit with Light-level geolocators or PinPoint-10 GPS tags.
# Ovenbird data included with the package
data(OVENdata, package = "MigConnectivity")
names(OVENdata)
## [1] "geo.bias" "geo.vcov" "isGL" "targetPoints" "originPoints"
## [6] "targetSites" "originSites" "originRelAbund" "originDist" "targetDist"
## [11] "originNames" "targetNames"
The figure below shows the two breeding regions (squares), and the three non-breeding regions (gray scale) used in Cohen et al. (2018) to estimate MC for Ovenbirds tracked with light-level geolocators and PinPoint-10 GPS tags.
# Load packages used below
library(sf)
library(terra)
library(maps)
# Set the crs to WGS84
originSitesWGS84 <- st_transform(OVENdata$originSites, 4326)
targetSitesWGS84 <- st_transform(OVENdata$targetSites, 4326)
# Create a simple plot of the origin and and target sites
op <- graphics::par(no.readonly = TRUE)
on.exit(graphics::par(op))
par(mar=c(0,0,0,0))
plot(originSitesWGS84,
xlim=c(terra::ext(targetSitesWGS84)[1],
terra::ext(targetSitesWGS84)[2]),
ylim=c(terra::ext(targetSitesWGS84)[3],
terra::ext(originSitesWGS84)[4]))
plot(targetSitesWGS84,
add = TRUE,
col=c("gray70","gray35","gray10"))
map("world", add=TRUE)
The following code demonstrates how to estimate transition
probabilities using location data from light-level geolocators and
PinPoint-10 GPS tags. Note: When using a combination of
light-level geolocators and other more precise tracking technology such
as GPS tags, be sure to include both isGL
and
isTelemetry
vectors. Below, we create the
isTelemetry
vector as the inverse of the isGL
vector.
(OVENpsi <- estTransition(isGL=OVENdata$isGL, # Logical vector: light-level geolocator(T)/GPS(F)
isTelemetry = !OVENdata$isGL, # Location vector: light-level geolocator(F)/GPS(T)
geoBias = OVENdata$geo.bias, # Light-level geolocator location bias
geoVCov = OVENdata$geo.vcov, #Light-level geolocator covariance matrix
targetSites = OVENdata$targetSites, # Non-breeding / target sites
originSites = OVENdata$originSites, # Breeding / origin sites
targetNames = OVENdata$targetNames, # Names of nonbreeding/target sites
originNames = OVENdata$originNames, # Names of breeding/origin sites
originPoints = OVENdata$originPoints, # Capture locations
targetPoints = OVENdata$targetPoints, # Target locations from devices
resampleProjection = sf::st_crs(OVENdata$targetPoints),
maxTries = 300,
verbose = 0, # output options - see help(estTransition)
nSamples = 10)) # This is set low for example
## Migratory Connectivity Estimates
##
## Transition probability (psi) estimates (mean):
## FL Cuba Hisp
## NH 0.0000 0.1614 0.8386
## MD 0.3147 0.6853 0.0000
## +/- SE:
## FL Cuba Hisp
## NH 0.0000 0.06656 0.06656
## MD 0.1752 0.17515 0.00000
## 95% confidence interval (simple quantile):
## FL Cuba Hisp
## NH 0.00000 - 0.0000 0.05179 - 0.2500 0.75000 - 0.9482
## MD 0.04091 - 0.5877 0.41227 - 0.9591 0.00000 - 0.0000
##
## This is a subset of what's available inside this estMigConnectivity output.
## For more info, try ?estTransition or str(obj_name, max.level = 2).
Take a closer look at what is included in the output
New plotting functions allow users to quickly plot transition
probabilities including confidence intervals. Users can customize plots
to suit their needs as additional arguments (...
) are
supported.
# THE FIGS ARE TOO SMALL IN VINGETTE HTML SO NEED TO ADD ADDITIONAL PARAMETERS TO MAKE IT LOOK HALFWAY DECENT
plot(OVENpsi, legend = "top", cex = 0.5, las = 2)
Below we estimate transition probabilities for Yellow Warblers (Setophaga petechia) by integrating several different data sources such as tracking data (light-level geolocators) and genoscape assignments. Furthermore, the data sources were derived from both breeding and non-breeding individuals. The following parameters are needed to estimate transition probabilities with integrating different data types. Below, we provide a streamlined example once the data are formatted for the analysis. See Worked Examples for how to derive and structure the data for analysis.
# Read in the processed Yellow Warbler data
# see the Worked Examples Vignette for details on how data structured/created
set.seed(1)
newDir <- tempdir()
baseURL <- 'https://github.com/SMBC-NZP/MigConnectivity/blob/devpsi2/data-raw/YEWA/'
file.name <- "yewa_estTrans_data.rds"
url1 <- paste0(baseURL, file.name, '?raw=true')
temp <- paste(newDir, file.name, sep = '/')
utils::download.file(url1, temp, mode = 'wb')
YEWA_target_sites <- readRDS(temp)
YEWAdata <- readRDS(temp)
unlink(temp)
# take a quick look at the data #
str(YEWAdata, 1)
## List of 22
## $ originSites :Classes 'sf' and 'data.frame': 5 obs. of 3 variables:
## ..- attr(*, "sf_column")= chr "geometry"
## ..- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA
## .. ..- attr(*, "names")= chr [1:2] "population" "originSite"
## $ targetSites :Classes 'sf' and 'data.frame': 4 obs. of 3 variables:
## ..- attr(*, "sf_column")= chr "geometry"
## ..- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA
## .. ..- attr(*, "names")= chr [1:2] "Region" "targetSite"
## $ originPoints :Classes 'sf' and 'data.frame': 7 obs. of 3 variables:
## ..- attr(*, "sf_column")= chr "geometry"
## ..- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA
## .. ..- attr(*, "names")= chr [1:2] "bird" "Type"
## $ targetPoints :Classes 'sf' and 'data.frame': 210 obs. of 2 variables:
## ..- attr(*, "sf_column")= chr "geometry"
## ..- attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA
## .. ..- attr(*, "names")= chr "Type"
## $ originAssignment : num [1:203, 1:5] 6.16e-03 1.91e-17 1.86e-18 1.38e-20 5.45e-11 ...
## ..- attr(*, "dimnames")=List of 2
## $ originNames : chr [1:5] "Arctic" "Pacific Northwest" "Southwest" "Central" ...
## $ targetNames : chr [1:4] "Pacific and Central Mexico" "Atlantic Lowland Mexico" "Central America" "South America"
## $ nSamples : num 10
## $ isGL : logi [1:210] TRUE TRUE TRUE TRUE TRUE TRUE ...
## $ isTelemetry : logi [1:210] FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ isRaster : logi [1:210] FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ isProb : logi [1:210] FALSE FALSE FALSE FALSE FALSE FALSE ...
## $ captured : chr [1:210] "origin" "origin" "origin" "origin" ...
## $ geoBias : Named num [1:2] -6513 50965
## ..- attr(*, "names")= chr [1:2] "difflong" "difflat"
## $ geoVCov : num [1:2, 1:2] 2.59e+08 -8.94e+08 -8.94e+08 4.71e+09
## ..- attr(*, "dimnames")=List of 2
## $ verbose : num 2
## $ maxTries : num 400
## $ resampleProjection:List of 2
## ..- attr(*, "class")= chr "crs"
## $ nSim : num 40
## $ dataOverlapSetting: chr "none"
## $ targetRelAbund : Named num [1:4] 0.0881 0.1645 0.4287 0.3187
## ..- attr(*, "names")= chr [1:4] "Pacific and Central Mexico" "Atlantic Lowland Mexico" "Central America" "South America"
## $ originRelAbund : Named num [1:5] 0.169 0.125 0.284 0.247 0.175
## ..- attr(*, "names")= chr [1:5] "Arctic" "Pacific Northwest" "Southwest" "Central" ...
Below we estimate (psi) or transition probabilities using the
estTransition
function.
Note - in the Yellow Warbler data there are no overlap of data
sources for individuals, i.e., we only had one type of data for each
bird - so we set the overlap setting to “none”. However, when there’s
only one type of data in the whole dataset, the function runs faster if
you leave dataOverlapSetting
at “dummy”
## Run analysis for psi
psiYEWA <- estTransition(originSites = YEWAdata$originSites,
targetSites = YEWAdata$targetSites,
originPoints = YEWAdata$originPoints,
targetPoints = YEWAdata$targetPoints,
originAssignment = YEWAdata$originAssignment,
originNames = YEWAdata$originNames,
targetNames = YEWAdata$targetNames,
nSamples = 10,
isGL = YEWAdata$isGL,
isTelemetry = YEWAdata$isTelemetry,
isRaster = YEWAdata$isRaster,
isProb = YEWAdata$isProb,
captured = YEWAdata$captured,
geoBias = YEWAdata$geoBias,
geoVCov = YEWAdata$geoVCov,
originRaster = YEWAdata$originRaster,
verbose = 2,
maxTries = 400,
resampleProjection = YEWAdata$resampleProjection,
nSim = 10,
dataOverlapSetting = "none",
targetRelAbund = YEWAdata$targetRelAbund,
returnAllInput = FALSE)
## Configuring data overlap settings
## Warning in reassignInds(dataOverlapSetting = dataOverlapSetting, originPoints = originPoints, : Not all origin capture locations are within originSites. Assigning to closest site.
## Affects animal: 1
## Warning in reassignInds(dataOverlapSetting = dataOverlapSetting, originPoints = originPoints, : Not all origin capture locations are within originSites. Assigning to closest site.
## Affects animal: 2
## Warning in reassignInds(dataOverlapSetting = dataOverlapSetting, originPoints = originPoints, : Not all origin capture locations are within originSites. Assigning to closest site.
## Affects animal: 3
## Warning in reassignInds(dataOverlapSetting = dataOverlapSetting, originPoints = originPoints, : Not all origin capture locations are within originSites. Assigning to closest site.
## Affects animal: 4
## Creating targetAssignment
## Not all target capture locations are within targetSites. Assigning to closest site
## Warning in estTransitionBoot(isGL = isGL, isTelemetry = isTelemetry, isRaster = isRaster, : Not all target capture locations are within targetSites. Assigning to closest site.
## Affects animals: 133,134,135,136,137,138,139,140,141,142,143,144,145,146,184,189,190,191,192
## Starting bootstrap
## Bootstrap Run 1 of 10 at Fri Jan 12 15:13:56 2024
## Bootstrap Run 2 of 10 at Fri Jan 12 15:13:56 2024
## Bootstrap Run 3 of 10 at Fri Jan 12 15:13:56 2024
## Bootstrap Run 4 of 10 at Fri Jan 12 15:13:56 2024
## Bootstrap Run 5 of 10 at Fri Jan 12 15:13:57 2024
## Bootstrap Run 6 of 10 at Fri Jan 12 15:13:57 2024
## Bootstrap Run 7 of 10 at Fri Jan 12 15:13:57 2024
## Bootstrap Run 8 of 10 at Fri Jan 12 15:13:57 2024
## Bootstrap Run 9 of 10 at Fri Jan 12 15:13:58 2024
## Bootstrap Run 10 of 10 at Fri Jan 12 15:13:58 2024
## Migratory Connectivity Estimates
##
## Transition probability (psi) estimates (mean):
## Pacific and Central Mexico Atlantic Lowland Mexico Central America
## Arctic 0.00000 0.74968 0.2503
## Pacific Northwest 0.03625 0.24841 0.7153
## Southwest 0.40188 0.05573 0.5424
## Central 0.00000 0.08382 0.6125
## East 0.00000 0.00000 0.0000
## South America
## Arctic 0.0000
## Pacific Northwest 0.0000
## Southwest 0.0000
## Central 0.3037
## East 1.0000
## +/- SE:
## Pacific and Central Mexico Atlantic Lowland Mexico Central America
## Arctic 0.00000 0.12899 0.12899
## Pacific Northwest 0.03904 0.04066 0.05800
## Southwest 0.06930 0.03869 0.07157
## Central 0.00000 0.02048 0.05509
## East 0.00000 0.00000 0.00000
## South America
## Arctic 0.00000
## Pacific Northwest 0.00000
## Southwest 0.00000
## Central 0.05385
## East 0.00000
## 95% confidence interval (simple quantile):
## Pacific and Central Mexico Atlantic Lowland Mexico Central America
## Arctic 0.00000 - 0.0000 0.60667 - 0.9786 0.02143 - 0.3933
## Pacific Northwest 0.00000 - 0.1020 0.19500 - 0.3015 0.61970 - 0.7942
## Southwest 0.28446 - 0.5071 0.00000 - 0.1137 0.44228 - 0.6668
## Central 0.00000 - 0.0000 0.05835 - 0.1209 0.53869 - 0.7024
## East 0.00000 - 0.0000 0.00000 - 0.0000 0.00000 - 0.0000
## South America
## Arctic 0.00000 - 0.0000
## Pacific Northwest 0.00000 - 0.0000
## Southwest 0.00000 - 0.0000
## Central 0.22664 - 0.3799
## East 1.00000 - 1.0000
##
## This is a subset of what's available inside this estMigConnectivity output.
## For more info, try ?estTransition or str(obj_name, max.level = 2).
Plot the results using the built-in plotting function