Skip to contents

This function creates the list used as the input for the stan model.

Usage

make_data_sdm(
  y,
  time,
  site,
  z,
  x,
  .toggles,
  .priors,
  family = "gamma",
  reorder = TRUE,
  phi_hat = FALSE
)

Arguments

y

a numeric vector of species' densities.

time

an vector indicating the time point associated to each element of y.

site

an vector indicating the sites associated to each element of y.

z

a design matrix of variables associated to the probability of absence at each site/time.

x

a design matrix of variables associated to the non-zero densities.

.toggles

a list of toggles for model components. The components are:

  • cloglog: 1 to use the complementary log-log and 0 for the logit link function for the absence probabilities.

  • movement: 1 to allow for (adjacent) moviment; 0 for static.

  • est_surv: 1 to estimate survival rates and 0 otherwise.

  • ar_re: "rec" to incorporate an AR(1) process density. The only other accepted option is "none"

.priors

a list of priors hyperparameters.

family

a character specifying the family of the probability distribution assumed for density. The options are:

  • "gamma" (default): gamma parametrized in terms of its mean;

  • "lognormal": log-normal parametrized in terms of its mean;

  • "loglogistic": log-logistic parametrized in terms of its mean.

  • "lognormal_legacy" (default): log-normal with its usual parametrization;

reorder

a boolean telling whether the data needs to be reordered. The default is TRUE and means the data points will be ordered by site and time, respectively.

phi_hat

a boolean indicating whether the prior on phi should be determined through the data.

Value

a list to be used as the input for a stan model

Author

lcgodoy