make_spatial_info: Build objects related to spatial information

View source: R/make_spatial_info.R

make_spatial_infoR Documentation

Build objects related to spatial information

Description

make_spatial_info builds a tagged list with all the spatial information needed for Data_Fn

Usage

make_spatial_info(
  n_x,
  Lon_i,
  Lat_i,
  Extrapolation_List,
  knot_method = NULL,
  Method = "Mesh",
  anisotropic_mesh = NULL,
  Kmeans = NULL,
  grid_size_km = 50,
  grid_size_LL = 1,
  fine_scale = FALSE,
  Network_sz_LL = NULL,
  iter.max = 1000,
  randomseed = 1,
  nstart = 100,
  DirPath = getwd(),
  Save_Results = FALSE,
  LON_intensity,
  LAT_intensity,
  backwards_compatible_kmeans = FALSE,
  mesh_package = "INLA",
  ...
)

Arguments

n_x

the number of vertices in the SPDE mesh (determines the spatial resolution when Method="Mesh")

Lon_i

Numeric vector, providing longitude for each sample

Lat_i

Numeric vector, providing latitude for each sample

Extrapolation_List

the output from make_extrapolation_info

knot_method

whether to determine location of GMRF vertices based on the location of samples knot_method=`samples` or extrapolation-grid cells within the specified strata knot_method='grid'; default knot_method=NULL is coerced to knot_method=`samples`

Method

a string specifying the form of spatial smoother with the following possible options:

Method="Mesh"

the SPDE method using geometric anisotropy as originally developed by INLA (recommended as default)

Method="Barrier"

the isotropic SPDE method but including barriers (i.e., preventing correlations from traveling over land); note that this feature is still in development and may change without warning

Method="Grid"

a 1st-order autoregressive process in two-dimensional spatial coordinates

Method="Stream_network"

an Ornstein-Uhlenbeck process specified along an acyclic graphc, e.g., representing a stream network

Method="Spherical_mesh"

the isotropic SPDE method with distances defined based on sphierical distances; note that this feature has not been extensively tested and please contract package author if interested in helping to do so

anisotropic_mesh

OPTIONAL, anisotropic mesh (if missing, its recalculated from loc_x)

grid_size_km

the distance between grid cells for the 2D AR1 grid (determines spatial resolution when Method="Grid")

grid_size_LL

the distance between grid cells for the 2D AR1 grid (determines spatial resolution when Method="Spherical_mesh")

fine_scale

a Boolean indicating whether to ignore (fine_scale=FALSE) or account for (fine_scale=TRUE) fine-scale spatial heterogeneity; See details for more informatino

Network_sz_LL

data frame with variables "parent_s", "child_s", "dist_s", "Lat", "Lon", with default value Network_sz_LL=NULL where non-default values are only needed when Method="Stream_network" (determines spatial resolution when Method="Stream_network")

iter.max

the number of iterations used per k-means algorithm (default=1000)

randomseed

a random number seed

nstart

the number of times that the k-means algorithm is run while searching for the best solution (default=100)

DirPath

a directory where the function looks for a previously-saved output (default is working directory)

Save_Results

a boolean stating whether to save the output (Default=TRUE)

backwards_compatible_kmeans

a boolean stating how to deal with changes in the kmeans algorithm implemented in R version 3.6.0, where backwards_compatible_kmeans==TRUE modifies the default algorithm to maintain backwards compatibility, and where backwards_compatible_kmeans==FALSE breaks backwards compatibility between R versions prior to and after R 3.6.0.

...

additional arguments passed to inla.mesh.create

Details

fine_scale=TRUE is a new feature starting in V8.0.0 which triggers two major changes:

  1. projecting Gaussian Markov random fields from knots to sampling and extrapolation-grid locations using bilinear interpolation (i.e., piecewise linear smoothing), and

  2. including density covariates individually for extrapolation-grid and sampling locations.

fine_scale=FALSE is designed to be backwards compatible with earlier versions, although V8.0.0 may also require changes to input naming conventions for covariates to specify the same model and attain the same fit.

LON_intensity and LAT_intensity allow users to specify locations that are used by the k-means algorithm to determine the location of knots, where e.g. users can either hard-code the desired knot locations via these inputs (using n_x greater than this number of locations), or use the extrapolation-grid to ensure that knots are located proportional to that grid.

Value

Tagged list containing objects for running a VAST model

MeshList

A tagged list with inputs related to the SPDE mesh

GridList

A tagged list with inputs related to the 2D AR1 grid

a_xl

A data frame with areas for each knot and each strattum

loc_UTM

A data frame with the converted UTM coordinates for each sample

Kmeans

Output from make_kmeans with knots for a triangulated mesh

knot_i

The knot associated with each sample

Method

The Method input (for archival purposes)

loc_x

The UTM location for each knot

Author(s)

James Thorson, Merrill Rudd


James-Thorson/FishStatsUtils documentation built on Feb. 6, 2024, 4:26 a.m.