INLAPPSealsPoissonReg: Seal counting using INLA and Poisson regression formulation

Description Usage Arguments Value

View source: R/PoissonRegressionFunction.R

Description

Approximates a Log-Gaussian Cox process with a regression formulation and fits seal counts from transects to it. Samples from the the fitted model to compute the posterior predictive distribution of the total number of seals within an area which the transects are spanning

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
INLAPPSealsPoissonReg(
  resultsBaseFolder = "./Results/PoissonReg",
  sealPhotoDataFile = system.file("extdata", "processed", "OriginalSealsKm.rds", package
    = "SealCoxProcess"),
  sealTransectDataFile = system.file("extdata", "processed",
    "OigardTablesTransformed.rds", package = "SealCoxProcess"),
  satelliteDataFolder = system.file("extdata", "processed", package = "SealCoxProcess"),
  sealType = "hooded",
  spatial = TRUE,
  covariate.fitting = "linear",
  covariates.type = "band1",
  additional.iid.term = FALSE,
  noSamp = 5000,
  standardMesh = FALSE,
  convHullVar.convex = -0.15,
  convHullVar.concave = convHullVar.convex,
  convHullVar.resolution = c(120, 120),
  meshVar.max.edge = c(2, 10),
  meshVar.offset = 6,
  meshVar.cutoff = c(0.195, 0.23),
  y.cutoff.boundary = -60,
  Matern.alpha = 2,
  grid.pixelsize = 0.2,
  INLA.theta.startval = NULL,
  INLA.verbose = FALSE,
  parallelize.numCores = 10,
  parallelize.noSplits = parallelize.numCores,
  poisson.maxEvals = 5 * 10^5,
  results.CI.level = 0.95,
  additional_comment = "",
  save.data = TRUE,
  delete.temp = TRUE,
  testing = FALSE,
  leaveOutTransect = FALSE,
  transectAsCountDomain = TRUE,
  CVFold = list(0, 0, 0),
  INLA.constr = TRUE
)

Arguments

resultsBaseFolder

String, indicating the path to the base folder where all results are to be stored

sealPhotoDataFile

String, indicating the file where seal photo data are stored

sealTransectDataFile

String, indicating the file where seal transect data are stored

satelliteDataFolder

String, indicating the path to the folder where the satellite data are stored (in files on the form "cov_grid_[covariates.type].rds")

sealType

String, indicating which seal type to model "hooded" (default as it is quicker), or "harps"

spatial

Logical indicating whether a spatial spde model should be used

covariate.fitting

String, indicating how to model covariates. "no", "linear", "quadratic" (default), "linAndLog" or "nonlinear"

covariates.type

String equal to "band1" or "band2" indicating which of the bands from the satellite data should be used.

additional.iid.term

Logical, indicating whether to include an additional iid (Gaussian) term in the latent field specification. FALSE is default

noSamp

Numeric, indicating the number of samples from posterior model to use when computing the posterior predictive distribution. 5000 (default) typically sufficient.

standardMesh

Logical indicating whether a standard mesh only fixing mesh points at the photo centers should be created. Defaults to FALSE indicating that the special mesh with Voronoi tesselations corresponding to the photos should be used.

convHullVar.convex

Numeric, corrresponding to the convex parameter of inla.nonvonvex.hull. See ?inla.nonconvex.hull for details

convHullVar.concave

Numeric, corrresponding to the concave parameter of inla.nonvonvex.hull. See ?inla.nonconvex.hull for details

convHullVar.resolution

Numeric vector of length 2, corrresponding to the resolution parameter of inla.nonvonvex.hull. See ?inla.nonconvex.hull for details

meshVar.max.edge

Numeric, corrresponding to the max.edge parameter of inla.mesh.2d. Smaller values gives smaller triangles outside triangles. See ?inla.mesh.2d for details

meshVar.offset

Numeric, corrresponding to the offset parameter of inla.mesh.2d. See ?inla.mesh.2d for details

meshVar.cutoff

Numeric vector, where the indicies corrresponds to the cutoff parameter of inla.mesh.2d. See ?inla.mesh.2d for details

y.cutoff.boundary

Numeric vector deciding the y-values which should be the coundary for the different cutoff-values. NULL means the first is applied everywhere

Matern.alpha

Numeric, corresponding to the alpha parameter in the Matern covariance function (2 is the default)

grid.pixelsize

Numeric, denoting the size (in km, in both x- and y-direction) of each pixel of the grid being used

INLA.theta.startval

List containing the start values for the theta parameter in the INLA run. (NULL indicates that automatic start values should be used, and is the default)

INLA.verbose

Logical, indicating whether verbose printing should be used when running the actual inla function

parallelize.numCores

Numeric, corresponding to the number of cores any parallelization should be run at

parallelize.noSplits

Numeric, deciding how many sublists samp should be splitted into. Should be a multiple of parallelize.numCores for the highest efficiency. The larger number the less memory is used (and longer time).

poisson.maxEvals

Numeric, corresponding to maximum number of points the Poisson distribution should be evaluated at (a much smaller number is typically used)

results.CI.level

Numeric, denoting the confidence/credibility degree to use in the final credibility interval for the total number of counts

additional_comment

String, where any comments related to the actual run can be given

save.data

Logical, indicating whether input variables, data and results should be saved (TRUE is default)

delete.temp

Logical, indicating whether temporary stored samples and associated eta grids should be deleted

testing

Logical, indicating whether the testing parts of this function should be used

leaveOutTransect

The transect number for the transect to remove from the modelling fitting and then fit (defaults to FALSE, i.e. none)

transectAsCountDomain

Logical indicating whether the transects should be used as counting domain when they are left out of the modeling (does not apply if leaveOutTransect=F)

CVFold

List of size 3. The is a vector indicating the fold number(s) to remove; the second a single number with the total number of folds; the third is a single number indicates whether it should be a fixed (1) "sample" based on the transect number, or random (0) sample. Defaults to c(0,0,0) which means no cross validation is performed

INLA.constr

Logical deciding whether the SPDE model should be fitted with the constaint that it integrates to zero or not.

Value

Nothing really, but saves results in the resultsBaseFolder


PointProcess/SealPupProduction-JRSSC-code documentation built on Jan. 27, 2020, 10:06 p.m.