# NOT RUN {
#######################################################################
#Example 1: Different initial population abundances.
#######################################################################
w_clim(y_ini = c(N = 100, N = 200, N = 400),
temp_cmin = rep(18,3),
temp_cmax = rep(30,3),
ro = rep(0.7,3),
lambda = rep(0.00005,3),
lat = rep(-33,3),
lon = rep(-71,3),
s = 5,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
#######################################################################
#Example 2: Different thermal tolerance ranges.
#######################################################################
temp_cmin3 <- 18
temp_cmin2 <- 10/9*temp_cmin3
temp_cmin1 <- 10/9*temp_cmin2
temp_cmax1 <- 32.4
temp_cmax2 <- 10/9*temp_cmax1
temp_cmax3 <- 10/9*temp_cmax2
w_clim(y_ini = c(N = 100, N = 100, N = 100),
temp_cmin = c(temp_cmin1,temp_cmin2,temp_cmin3),
temp_cmax = c(temp_cmax1,temp_cmax2,temp_cmax3),
ro = rep(0.7,3),
lambda = rep(0.00005,3),
lat = rep(-33,3),
lon = rep(-71,3),
s = 5,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
#######################################################################
#Example 3: Different latitudes.
#######################################################################
lat1 <- -10
lat2 <- -33
lat3 <- -42
w_clim(y_ini = c(N = 100, N = 100, N = 100),
temp_cmin = rep(18,3),
temp_cmax = rep(40,3),
ro = rep(0.7,3),
lambda = rep(0.00005,3),
lat = c(lat1,lat2,lat3),
lon = rep(-71,3),
s = 5,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
#######################################################################
#Example 4: Different marginal losses by a non-thermodependent
# component of intraspecific competition.
#######################################################################
lambda3 <- 0.01
lambda2 <- 1/2*lambda3
lambda1 <- 1/2*lambda2
w_clim(y_ini = c(N = 100, N = 100, N = 100),
temp_cmin = rep(18,3),
temp_cmax = rep(30,3),
ro = rep(0.7,3),
lambda = c(lambda1,lambda2,lambda3),
lat = rep(-33,3),
lon = rep(-71,3),
s = 5,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
#######################################################################
#Application example I: Bioclimatic variable
# (Annual Mean Temperature).
#######################################################################
#We consider a population of Macrolophus pygmaeus in three different
#locations, and its intrinsic growth rate is adjusted to data obtained
#from Rezende and Bozinovic (2019).
github_link <- "https://github.com/Victor-Saldana/epcc/raw/main/M_pygmaeus.xlsx"
library(httr)
temp_file <- tempfile(fileext = ".xlsx")
req <- GET(github_link,
authenticate(Sys.getenv("GITHUB_PAT"), ""),
write_disk(path = temp_file))
M_pygmaeus <- readxl::read_excel(temp_file)
TPC <- rate_adjustment(data = M_pygmaeus)
#locality 1
lat1 <- 38.1827778
lon1 <- -1.7380555
#locality 2
lat2 <- 41.01384
lon2 <- 28.94966
#locality 3
lat3 <- 39.7213889
lon3 <- 21.63416638888889
w_clim(y_ini = c(N = 100, N = 100, N = 100),
temp_cmin = rep(TPC$temp_cmin,3),
temp_cmax = rep(TPC$temp_cmax,3),
ro = rep(TPC$ro,3),
lambda = rep(0.00005,3),
lat = c(lat1,lat2,lat3),
lon = c(lon1,lon2,lon3),
s = 1,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
#######################################################################
#Application example II: Bioclimatic variable
# (Max Temperature of Warmest Month).
#######################################################################
#We consider a population of Macrolophus pygmaeus in three different
#locations, and its intrinsic growth rate is adjusted to data obtained
#from Rezende and Bozinovic (2019).
github_link <- "https://github.com/Victor-Saldana/epcc/raw/main/M_pygmaeus.xlsx"
library(httr)
temp_file <- tempfile(fileext = ".xlsx")
req <- GET(github_link,
authenticate(Sys.getenv("GITHUB_PAT"), ""),
write_disk(path = temp_file))
M_pygmaeus <- readxl::read_excel(temp_file)
TPC <- rate_adjustment(data = M_pygmaeus)
#locality 1
lat1 <- 38.1827778
lon1 <- -1.7380555
#locality 2
lat2 <- 41.01384
lon2 <- 28.94966
#locality 3
lat3 <- 39.7213889
lon3 <- 21.63416638888889
w_clim(y_ini = c(N = 100, N = 100, N = 100),
temp_cmin = rep(TPC$temp_cmin,3),
temp_cmax = rep(TPC$temp_cmax,3),
ro = rep(TPC$ro,3),
lambda = rep(0.00005,3),
lat = c(lat1,lat2,lat3),
lon = c(lon1,lon2,lon3),
s = 5,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
#######################################################################
#Application example III: Bioclimatic variable
# (Mean Temperature of Warmest Quarter).
#######################################################################
#We consider a population of Macrolophus pygmaeus in three different
#locations, and its intrinsic growth rate is adjusted to data obtained
#from Rezende and Bozinovic (2019).
github_link <- "https://github.com/Victor-Saldana/epcc/raw/main/M_pygmaeus.xlsx"
library(httr)
temp_file <- tempfile(fileext = ".xlsx")
req <- GET(github_link,
authenticate(Sys.getenv("GITHUB_PAT"), ""),
write_disk(path = temp_file))
M_pygmaeus <- readxl::read_excel(temp_file)
TPC <- rate_adjustment(data = M_pygmaeus)
#locality 1
lat1 <- 38.1827778
lon1 <- -1.7380555
#locality 2
lat2 <- 41.01384
lon2 <- 28.94966
#locality 3
lat3 <- 39.7213889
lon3 <- 21.63416638888889
w_clim(y_ini = c(N = 100, N = 100, N = 100),
temp_cmin = rep(TPC$temp_cmin,3),
temp_cmax = rep(TPC$temp_cmax,3),
ro = rep(TPC$ro,3),
lambda = rep(0.00005,3),
lat = c(lat1,lat2,lat3),
lon = c(lon1,lon2,lon3),
s = 10,
res = 5,
time_start = 2000,
time_end = 2070,
leap = 1/12)
# }
Run the code above in your browser using DataLab