# Example with kernels named "P" and "F", and a domain "z"
kernel_impl_list <- list(P = list(int_rule = "midpoint",
state_start = "z",
state_end = "z"),
F = list(int_rule = "midpoint",
state_start = "z",
state_end = "z"))
# an equivalent version using make_impl_args_list
kernel_impl_list <- make_impl_args_list(
kernel_names = c("P", "F"),
int_rule = c("midpoint", "midpoint"),
state_start = c("z", "z"),
state_end = c("z", "z")
)
data(sim_di_det_ex)
proto_ipm <- sim_di_det_ex$proto_ipm
# define_domains
lower_bound <- 1
upper_bound <- 100
n_meshpoints <- 50
define_domains(proto_ipm, c(lower_bound, upper_bound, n_meshpoints))
# define_pop_state with a state variable named "z". Note that "n_" is prefixed
# to denote that it is a population state function!
define_pop_state(proto_ipm, n_z = runif(100))
# alternative, we can make a list before starting to make the IPM
pop_vecs <- list(n_z = runif(100))
define_pop_state(proto_ipm, pop_vectors = pop_vecs)
# define_env_state. Generates a random draw from a known distribution
# of temperatures.
env_sampler <- function(env_pars) {
temp <- rnorm(1, env_pars$temp_mean, env_pars$temp_sd)
return(list(temp = temp))
}
env_pars <- list(temp_mean = 12, temp_sd = 2)
define_env_state(
proto_ipm,
env_values = env_sampler(env_pars),
data_list = list(env_sampler = env_sampler,
env_pars = env_pars)
)
data(iceplant_ex)
z <- c(iceplant_ex$log_size, iceplant_ex$log_size_next)
pop_vecs <- discretize_pop_vector(z,
n_mesh = 100,
pad_low = 1.2,
pad_high = 1.2)
Run the code above in your browser using DataLab