Description Usage Arguments Details Value Examples
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.
1 | simLocations(r, beta, w, cells.all, d, seed = NULL)
|
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. |
simLocations simulates sample sites preferentially over a raster study region.
a list with the following keys:
status: numeric. Vector of 0/1 indicators representing whether the corresponding cell in cells.all was observed.
cells: numeric. Vector of cell ids from cells.all that were observed.
coords: matrix. Matrix of latitude (x) and longitude (y) coordinates from observed cells.
x: matrix. Matrix of intercept and covariate values from raster r at the center point of each cell in r.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.