runModel: Model fitting

Description Usage Arguments Value Examples

View source: R/runmodel.r

Description

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.

Usage

 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
)

Arguments

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 buildSpatialGrid to show the grid for a value of gridStep.

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?

Value

A list with components:

Examples

 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)  

alexdiana1992/FastOccupancy documentation built on Dec. 19, 2021, 12:32 a.m.