sim_data: Simulate data

Description Usage Arguments Examples

View source: R/data.R

Description

Simulate data under a specified model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
sim_data(
  sentinel_lon,
  sentinel_lat,
  sentinel_radius = 0.1,
  K = 3,
  source_weights = NULL,
  source_lon_min = -0.2,
  source_lon_max = 0,
  source_lat_min = 51.45,
  source_lat_max = 51.55,
  source_lon = NULL,
  source_lat = NULL,
  sigma_model = "single",
  sigma_mean = 1,
  sigma_var = 0.1,
  expected_popsize = 100,
  data_type = "counts",
  test_rate = 5,
  N = 150,
  dispersal_model = "normal"
)

Arguments

sentinel_lon

vector giving longitudes of sentinel sites.

sentinel_lat

vector giving latitudes of sentinel sites.

sentinel_radius

observation radius of the sentinel site (km).

K

the number of sources.

source_weights

the proportion of events coming from each source

source_lon_min

minimum limit on source longitudes.

source_lon_max

maximum limit on source longitudes.

source_lat_min

minimum limit on source latitudes.

source_lat_max

maximum limit on source latitudes.

source_lon

manually define source longitude positions. If NULL then drawn uniformly from limits specified in source_lon_min and source_lon_max.

source_lat

manually define source latitude positions. If NULL then drawn uniformly from limits specified in source_lat_min and source_lat_max.

sigma_model

set as "single" to use the same dispersal distance for all sources, or "independent" to use an independently drawn dispersal distance for each source.

sigma_mean

the prior mean of the parameter sigma (km).

sigma_var

the prior variance of the parameter sigma (km). Set to zero to use a fixed distance.

expected_popsize

the expected total number of observations (observed and unobserved) in the study area.

data_type

what model we wish to simulate under - a poisson, binomial or vanilla finite mixture corresponding to "counts", "prevalence" or "point-pattern" respectively

test_rate

The rate of the Poisson distribution with which we draw the number of individuals tested at each sentinel site

N

the number of events to distributed under a point-pattern model

dispersal_model

distribute points via a "normal", "cauchy" or "laplace" model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# State the number of sources to be generated
K_sim <- 3
# Create some sentinel site locations
sentinal_lon <- seq(-0.2, 0.0, l=11)
sentinal_lat <- seq(51.45, 51.55, l=11)
sentinal_grid <- expand.grid(sentinal_lon, sentinal_lat)
names(sentinal_grid) <- c("longitude", "latitude")
# Set their sentinel radius (this constant times true sigma)
sentinel_radius <- 0.25
# sim count data under a Poisson model
sim1 <- sim_data(sentinal_grid$longitude,
                sentinal_grid$latitude,
                sigma_model = "single",
                sigma_mean = 1,
                sigma_var = 0.5,
                sentinel_radius = sentinel_radius,
                K = K_sim,
                expected_popsize = 300)

Michael-Stevens-27/silverblaze documentation built on May 28, 2021, 5:47 p.m.