w_clim: Temperature trend obtained from WorldClim.

Description Usage Arguments Details Value References Examples

View source: R/w_clim.R

Description

This function allows simulating the effect of temperature trends on the abundance of ectotherm populations in different geographic locations. Temperature data is obtained from WorldClim.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
w_clim(
  y_ini = c(N = 400, N = 400, N = 400),
  temp_cmin = rep(18, 3),
  temp_cmax = c(25, 28, 32),
  ro = rep(0.7, 3),
  lambda = rep(5e-05, 3),
  lat = rep(-33, 3),
  lon = rep(-71, 3),
  s = 10,
  res = 5,
  time_start = 2000,
  time_end = 2070,
  leap = 1/12
)

Arguments

y_ini

Initial population values (must be written with its name: N).

temp_cmin

Minimum critical temperature.

temp_cmax

Maximum critical temperature.

ro

Population growth rate at optimum temperature.

lambda

Marginal loss by non-thermodependent intraspecific competition.

lat, lon

Geographical coordinates of some place of interest of study, in decimal degrees.

s

Bioclimatic variable.

res

Spatial resolution.

time_start

Start of time sequence.

time_end

End of time sequence.

leap

Sequence increase.

Details

Three populations and/or scenarios can be simulated simultaneously. The temperature trends are obtained by data extracted from WorldClim for the years 2000, 2050 and 2070 at a specific location. The function internally calls the function getData of the raster package (Hijmans, 2020) to obtain the bioclimatic variable of interest a given spatial resolution. An exponential expression is fitted using the nls function. In each input vector, the parameters for the three simulations must be specified (finite numbers for the initial population abundance). The simulations are obtained by a model that incorporates the effects of temperature over time, which leads to a non-autonomous ODE approach. This is function uses the ODE solver implemented in the package deSolve (Soetaert et al., 2010). In the first three examples, three geographic locations are considered for Macrolophus pygmaeus as reported in Sánchez et al. (2012).

Value

(1) A data.frame with columns having the simulated trends.

(2) A two-panel figure in which (a) shows the population abundance curves represented by solid lines and the corresponding carrying capacities are represented by shaded areas. In (b) the temperature trend is shown. The three simultaneous simulations are depicted by different colors, i.e. 1st brown, 2nd green and 3rd blue.

References

Hijmans, R.J. (2020). Package ‘raster’ (Version 3.3-13). pp. 1-249.

Rezende, E. L., & Bozinovic, F. (2019). Thermal performance across levels of biological organization. Philosophical Transactions of the Royal Society B: Biological Sciences, 374(1778), 20180549.doi:10.1098/rstb.2018.0549

Sanchez, J. A., Spina, M. L., & Perera, O. P. (2012). Analysis of the population structure of Macrolophus pygmaeus (Rambur) (Hemiptera: Miridae) in the Palaearctic region using microsatellite markers. Ecology and Evolution, 2(12), 3145-3159. doi:10.1002/ece3.420

Soetaert, K., Petzoldt, T., & Setzer, R. (2010). Solving Differential Equations in R: Package deSolve. Journal of Statistical Software, 33(9), 1 - 25. doi:http://dx.doi.org/10.18637/jss.v033.i09

Examples

  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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
## 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)

## End(Not run)

epcc documentation built on June 29, 2021, 9:07 a.m.