Description Usage Arguments Value Examples
This function fits the occupancy model of Diana et al. (2021). Note that in the following the parameters are described with the notations used in the paper.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | runModel(
data,
index_year,
index_site,
index_occ,
index_spatial_x = 0,
index_spatial_y = 0,
covariates_psi_text,
covariates_p_text,
prior_psi = 0.5,
sigma_psi = 2,
prior_p = 0.5,
sigma_p = 2,
usingYearDetProb = F,
usingSpatial = F,
gridStep,
storeRE = F,
nchain,
nburn,
niter,
verbose = T,
computeGOF = T
)
|
data |
The data frame containing the data. |
index_year |
The index of the column containing the year variable. |
index_site |
The index of the column containing the site variable. |
index_occ |
The index of the column containing the detections. |
index_spatial_x |
The index of the x coordinate of the site. |
index_spatial_y |
The index of the y coordinate of the site. |
covariates_psi_text |
Indexes of the column of the occupancy probability. To be separated by a comma, eg. "5,6,8". Set to "0" if no covariate is available |
covariates_p_text |
Indexes of the column of the detection probability. |
prior_psi |
Prior mean for the occupancy probability |
sigma_psi |
Standard deviation for the prior on the occupancy probability |
prior_p |
Prior mean for the detection probability |
sigma_p |
Standard deviation for the prior on the detection probability |
usingYearDetProb |
Should the model include year-specific detection probabilities (as opposed to a constant one)? |
usingSpatial |
Should the model include the auto-correlated spatial effects? |
gridStep |
Step of the grid to use for the approximation of the auto-correlated spatial effects. Use |
storeRE |
Should the model store the site-specific independent random effects for each iteration (instead of just their mean across all chain)? Not suggested if the number of sites is greater than 1000. |
nchain |
Number of chains. |
nburn |
Number of burn-in iterations. |
niter |
Number of (non burn-in) iterations. |
verbose |
Should the progress of the MCMC be printed?. |
computeGOF |
Should the model perform calculations of the goodness of fit? |
A list with components:
modelResults
A list with components:
beta_psi_output
An array of dimensions nchain
x niter
x (number of coefficients for
occupancy probability) containing the values of the coefficients of the occupancy probability.
The coefficients are reported in the order (year r.e., space r.e., covariates for time-space interaction,
standard covariates).
eps_unique_output
if storeRE = T
, an array of dimensions
nchain
x niter
x S containing the values of the site-specific independent random effects
of the occupancy probability. If storeRE = F
, a matrix of dimensions nchain
x S
containing the mean value of the random effect across a chain.
beta_p_output
An array of dimensions nchain
x niter
x (number of coefficients for
detection probability) containing the values of the coefficients of the detection probability.
The coefficients are reported in the order (intercepts, covariates).
sigma_T_output
A array of dimensions nchain
x niter
containing the values of
σ_T.
l_T_output
A array of dimensions nchain
x niter
containing the values of
l_T.
sigma_s_output
A array of dimensions nchain
x niter
containing the values of
σ_S.
l_s_output
A array of dimensions nchain
x niter
containing the values of
l_S.
sigma_eps_output
A array of dimensions nchain
x niter
containing the values of
σ_ε.
psi_mean_output
A array of dimensions nchain
x niter
containing the values of
the occupancy index.
GOF_output
A list with components:
gofYear_output
An array of dimensions nchain
x niter
x Y containing the values
of the test statistics of yearly detections.
gofSpace_output
An array of dimensions nchain
x niter
x (M), where M is the number
of regions in the approximation, containing the values of the test statistics of the detections in
each region.
trueYearStatistics
A vector containing the true values of the test statistics of the detections in each year.
trueSpaceStatistics
A vector containing the true values of the test statistics of the detections in each region
dataCharacteristics
: A list with components:
Years
A vector with the years.
X_tilde
A matrix of dimension M x 2, where M is the number of points chosen in the
spatial approximation, with the location of the points used for the approximation. The points are
arranged in the same as order as in the coefficients vector beta_psi_output
.
gridStep
The width of the grid chosen in the approximation.
usingSptial
Same as in the input.
usingYearDetProb
Same as in the input.
1 2 3 4 5 6 7 8 9 10 11 12 13 | modelResults <- runModel(sampleData,
index_year = 1,
index_site = 2,
index_occ = 8,
index_spatial_x = 3,
index_spatial_y = 4,
covariates_psi_text = "5",
covariates_p_text = "6-7",
usingSpatial = TRUE,
gridStep = .2,
nchain = 1,
nburn = 100,
niter = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.