update_sl_distr | R Documentation |
Update tentative step length or turning angle distribution from a fitted iSSF.
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_", ...)
object |
|
beta_sl |
|
beta_log_sl |
|
beta_sl_sq |
|
beta_log_sl_sq |
|
... |
Further arguments, none implemented. |
beta_cos_ta |
|
An amt_distr
object, which consists of a list with the name
of
the distribution and its parameters (saved in params
).
Brian J. Smith and Johannes Signer
fieberg2020guideamt
Wrapper to fit a distribution to data fit_distr()
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.