simLocations: simLocations

Description Usage Arguments Details Value Examples

View source: R/simData.R

Description

In this package, a disease surveillance system collects samples for a disease over cells in a raster. The sampling process may be preferential, assigning sampling locations in a way that is stochastically related to the disease process. Typically preferential sampling manifests itself when sampling locations are generally assigned in areas thought to be at high risk for the disease.

Usage

1
simLocations(r, beta, w, cells.all, d, seed = NULL)

Arguments

r:

RasterBrick. Raster representing the study region whose values are covariates associated with the sampling process.

beta:

numeric. Vector of parameters (including intercept) associated with the covariates in r.

w:

numeric. Vector of spatial random effects simulated from a Gaussian process.

cells.all:

numeric. Vector of integers representing id's of non-null cells in raster r.

d:

matrix. Distance matrix describing distances between cells in raster r.

seed:

numeric. Optional random seed value for reproducibility.

Details

simLocations simulates sample sites preferentially over a raster study region.

Value

a list with the following keys:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# create covariate raster
r <- aggregate(load_prism_pcs(), fact=10)

# get cell ids
cells.all <- c(1:ncell(r))[!is.na(values(r[[1]]))]

# get distance matrix 
d <- form_distance_matrix(r, cells.all)

# simulate Gaussian process
sigma <- Exponential(d, range = 7, phi = 5)
w <- mvrnorm(n = 1, mu = rep(0, length(cells.all)), sigma)

# simulate locations
locs <- simLocations(r, c(-1.50, 1.00, -0.25), w, cells.all, d)

# view raster of observed cells
r_loc <- r[[1]]
r_loc[!is.na(r_loc[])] <- locs$status
plot(r_loc)

brianconroy/preferential_surveillance documentation built on Nov. 23, 2021, 5:51 a.m.