update_distr_man: Manually update 'amt_distr'

update_distr_manR Documentation

Manually update amt_distr

Description

Functions to update amt_distr from iSSF coefficients

Usage

update_gamma(dist, beta_sl, beta_log_sl)

update_exp(dist, beta_sl)

update_hnorm(dist, beta_sl_sq)

update_lnorm(dist, beta_log_sl, beta_log_sl_sq)

update_vonmises(dist, beta_cos_ta)

Arguments

dist

⁠[amt_distr]⁠ The tentative distribution to be updated respective distributions.

beta_sl

⁠[numeric]⁠
The estimate of the coefficient of the step length.

beta_log_sl

⁠[numeric]⁠
The estimate of the coefficient of the log of the step length.

beta_sl_sq

⁠[character]⁠
The name of the coefficient of the square of the step length.

beta_log_sl_sq

⁠[character]⁠
The name of the coefficient of the square of log of the step length.

beta_cos_ta

⁠[numeric]⁠
The estimate of the coefficient of cosine of the turning angle.

Details

These functions are called internally by update_sl_distr() and update_ta_distr(). However, those simple functions assume that the selection-free step-length and turn-angle distributions are constant (i.e., they do not depend on covariates). In the case of interactions between movement parameters and covariates, the user will want to manually access these functions to update their selection-free movement distributions.

Value

A distribution

Examples

#  sh_forest <- get_sh_forest()
#  # Fit an SSF, then update movement parameters.
#
#   #Prepare data for SSF
#  ssf_data <- deer |>
#    steps_by_burst() |>
#    random_steps(n = 15) |>
#    extract_covariates(sh_forest) |>
#    mutate(forest = factor(forest, levels = 1:0,
#                      labels = c("forest", "non-forest")),
#    cos_ta_ = cos(ta_),
#    log_sl_ = log(sl_))
#
#  # Check tentative distributions
#  #    Step length
#  attr(ssf_data, "sl_")
#  #    Turning angle
#  attr(ssf_data, "ta_")
#
#  # Fit an iSSF (note model = TRUE necessary for predict() to work)
#  m1 <- ssf_data |>
#    fit_issf(case_ ~ forest * (sl_ + log_sl_ + cos_ta_) +
#                 strata(step_id_), model = TRUE)
#
#  # Update forest step lengths (the reference level)
#  forest_sl <- update_gamma(m1$sl_,
#                            beta_sl = m1$model$coefficients["sl_"],
#                            beta_log_sl = m1$model$coefficients["log_sl_"])
#
#  # Update non-forest step lengths
#  nonforest_sl <- update_gamma(m1$sl_,
#                               beta_sl = m1$model$coefficients["sl_"] +
#                                 m1$model$coefficients["forestnon-forest:sl_"],
#                               beta_log_sl = m1$model$coefficients["log_sl_"] +
#                                 m1$model$coefficients["forestnon-forest:log_sl_"])
#
#  # Update forest turn angles (the reference level)
#  forest_ta <- update_vonmises(m1$ta_,
#                               beta_cos_ta = m1$model$coefficients["cos_ta_"])
#
#  # Update non-forest turn angles
#  nonforest_ta <- update_vonmises(m1$ta_,
#                                  beta_cos_ta = m1$model$coefficients["cos_ta_"] +
#                                    m1$model$coefficients["forestnon-forest:cos_ta_"])
#

amt documentation built on June 25, 2024, 1:14 a.m.