update_distr: Update movement distributions

update_sl_distrR Documentation

Update movement distributions

Description

Update tentative step length or turning angle distribution from a fitted iSSF.

Usage

update_sl_distr(
  object,
  beta_sl = "sl_",
  beta_log_sl = "log_sl_",
  beta_sl_sq = "sl_sq_",
  beta_log_sl_sq = "log_sl_sq_",
  ...
)

update_ta_distr(object, beta_cos_ta = "cos_ta_", ...)

Arguments

object

⁠[fit_clogit]⁠
A fitted iSSF model.

beta_sl

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

beta_log_sl

⁠[character]⁠
The name 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.

...

Further arguments, none implemented.

beta_cos_ta

⁠[character]⁠
The name of the coefficient of cosine of the turning angle.

Value

An amt_distr object, which consists of a list with the name of the distribution and its parameters (saved in params).

Author(s)

Brian J. Smith and Johannes Signer

References

\insertRef

fieberg2020guideamt

See Also

Wrapper to fit a distribution to data fit_distr()

Examples


# Fit an SSF, then update movement parameters.
data(deer)
mini_deer <- deer[1:100, ]
sh_forest <- get_sh_forest()

# Prepare data for SSF
ssf_data <- mini_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
sl_distr_params(ssf_data)
attr(ssf_data, "sl_")
#    Turning angle
ta_distr_params(ssf_data)

# Fit an iSSF
m1 <- ssf_data |>
  fit_issf(case_ ~ forest +
               sl_ + log_sl_ + cos_ta_ +
               strata(step_id_))

# Update step length distribution
new_gamma <- update_sl_distr(m1)

# Update turning angle distribution
new_vm <- update_ta_distr(m1)

# It is also possible to use different step length distributions

# exponential step-length distribution
s2 <- mini_deer |> steps_by_burst()
s2 <- random_steps(s2, sl_distr = fit_distr(s2$sl_, "exp"))
m2 <- s2 |>
  fit_clogit(case_ ~ sl_ + strata(step_id_))
update_sl_distr(m2)

# half normal step-length distribution
s3 <- mini_deer |> steps_by_burst()
s3 <- random_steps(s3, sl_distr = fit_distr(s3$sl_, "hnorm"))
m3 <- s3 |>
  mutate(sl_sq_ = sl_^2) |>
  fit_clogit(case_ ~ sl_sq_ + strata(step_id_))
update_sl_distr(m3)

# log normal step-length distribution
s4 <- mini_deer |> steps_by_burst()
s4 <- random_steps(s4, sl_distr = fit_distr(s4$sl_, "lnorm"))
m4 <- s4 |>
  mutate(log_sl_ = log(sl_), log_sl_sq_ = log(sl_)^2) |>
  fit_clogit(case_ ~ log_sl_ + log_sl_sq_ + strata(step_id_))
update_sl_distr(m4)




amt documentation built on March 31, 2023, 5:29 p.m.