gail_sim_rate: Sets Incidence Rates for Simulated Regions

Description Usage Arguments Details Value See Also Examples

Description

Function for the simulation framework in GAIL. Create the underlying rate of cases for each regular spatial unit which can follow a user-specified pattern. This can be used to generate the rate of cases, as well as the rate of individuals being in the irregular spatial unit.

For creating simulated data, this function can be bypassed if the user creates variables named 'case_rate' and 'rural_rate' in the set of regular spatial units.

Usage

1
2
gail_sim_rate(units_reg, rate_base = c(0.03, 0.07), rate_spec = NULL,
  seed = NULL)

Arguments

units_reg

Set of regular spatial units

rate_base

Vector of length 2 giving upper and lower bounds for uniform distribution. The base rate is randomly allocated between these two values. Default is c(0.03, 0.07).

rate_spec

A data.frame describing coordinates and change to base rate. See details.

seed

If given, sets the seed for the RNG.

...

Space for additional arguments (e.g., for fields::cover.design).

Details

Each row of rate_spec creates a 'hotspot' (or 'coldspot') in terms of the incidence rate of cases. That is: areas in the spatial domain which have an increased or decreased rate. This should be a data.frame (or comprable object) with columns: mx, my, ax, ay, efc. The hotspot is centered at the point (mx, my), while ax and ay control the size in the x and y directions, respectively, with larger values corresponding to larger range in that dimension. The efc value is the effect size, which acts as a multiplier for the base rate of indidence.

The incidence rate is generated by first drawing a base rate for each spatial unit from a uniform distribution with bounds given by rate_base.

Then n=2000 points are drawn uniformly across the spatial domain (100x100 square). These points are given a weight on the interval [0, 1], which decreases from 1 at the center of the hotspot down to 0. The weight is multiplied by the hotspot effect size (efc), and shifted so that each of the 2000 points have a value on the interval [1, efc]. The mean effect is taken for all individuals contained within a spatial region, and that mean is used as a multiplier for the base rate of that region.

Value

Returns a vector of length nrow(units_reg) which contains

See Also

gail_sim_regions, gail_sim_pop, gail_sim_index, gail_sim_assign

Examples

 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
## Not run: 
 ## Generate Regions
 loca_reg <- gail_gen_regions( npoints=40, type="regular", nedge=10, suid="reg" )
 
 ## Generate incidence rate
 rate_spec <- data.frame(
   mx  = c(25, 60), 
   my  = c(25, 80), 
   ax  = c(10, 40), 
   ay  = c(25, 20),
   efc = c( 0.15 , 4.0 )
 )
 loca_reg[["case_rate"]] <- gail_sim_rate( loca_reg,  rate_base=c(0.03,0.07), 
                                            rate_spec=rate_spec, seed=42 )
 ggplot( loca_reg ) +
   geom_sf( aes(fill=case_rate) )
 
 ## Generate rate of being in irregular locations
 irr_spec <- data.frame(
   mx  = c(85, 20, 25, 60), 
   my  = c(15, 80, 25, 80), 
   ax  = c(20, 10, 10, 40), 
   ay  = c(20, 20, 25, 20),
   efc = c(4.0, 4.0, 0.15 , 0.15 )
 )
  
 loca_reg[["rural_rate"]] <- gail_sim_rate( loca_reg,  rate_base=c(0.03,0.07), 
                                            rate_spec=rate_spec, seed=42 )
    
 ggplot( loca_reg ) +
   geom_sf( aes(fill=rural_rate) )
    

## End(Not run)

jelsema/GAIL documentation built on June 29, 2019, 11:48 a.m.