| use_vr_model {ipmr} | R Documentation | 
Predict methods in ipmr
Description
This function is used when a predict method is incorporated
into the vital rate expressions of a kernel. Generally, ipmr can handle this
without any additional user effort, but some model classes will fail (often
with an obscure error message).
When this happens, use_vr_model can ensure that model object is
correctly represented in the data_list.
Usage
use_vr_model(model)
Arguments
| model | A fitted model object representing a vital rate. Primarily used to avoid
writing the mathematical expression for a vital rate, and using a  | 
Details
ipmr usually recognizes model objects passed into the data_list argument
automatically. Unfortunately, sometimes it'll miss one, and the user will need
to manually protect it from the standard build process. This function
provides a wrapper around that process. Additionally, please file a bug
report here: https://github.com/padrinoDB/ipmr/issues describing what type
of model you are trying to use so it can be added to later versions of the
package.
Wrap a model object in use_vr_model when building the data_list
to pass to define_kernel.
Value
A model object with a "flat_protect" attribute.
Examples
data(iceplant_ex)
grow_mod <- lm(log_size_next ~ log_size, data = iceplant_ex)
surv_mod <- glm(survival ~ log_size, data = iceplant_ex, family = binomial())
data_list <- list(
  grow_mod = use_vr_model(grow_mod),
  surv_mod = use_vr_model(surv_mod),
  recruit_mean = 20,
  recruit_sd   = 5
)