gail_sim_assign: Allocate Simulated Population

Description Usage Arguments Details See Also Examples

Description

Function for the simulation framework in GAIL. Determined the spatial unit (both regular and irregular) into which a population individual falls, and randomly samples whether an individual is case vs non-case and whether an individual is in regular or non-regular spatial unit.

Usage

1
gail_sim_assign(units_reg, units_irr, loca_pop, seed = NULL)

Arguments

units_reg

Set of regular spatial units

units_irr

Set of irregular spatial units

loca_pop

True locations of the population

seed

If given, sets the seed for the RNG.

Details

The argument units_reg must have columns case_rate and rural_rate. These will ordinarily be generated by other simulation functions in the process of simulating the data.

This function assigns case/non and regular/irregular by:

  1. Assigning entire population to the regular spatial units

  2. For each regular spatial unit, independently sampling based on case rate (to generate cases) and rural rate (to generate individuals reporting the irregular spatial unit).

See Also

gail_sim_regions, gail_sim_rate, gail_sim_pop, gail_sim_index

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
## Not run: 
 
 ## Generate Regions
 loca_reg <- gail_gen_regions( npoints=40, type="regular", nedge=10, suid="reg" )
 loca_irr <- 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 )
 
 ## 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 )
    
 ## Generate population
 beta_setup <- data.frame(
   nn=c(5000, 1000, 500),
   mx=c(50, 25, 60), 
   my=c(50, 25, 80), 
   sx=c(30, 10, 10), 
   sy=c(30, 10, 5)
 )
 loca_pop <- gail_sim_pop( loca_reg, loca_irr, method="beta", 
                           beta_setup=beta_setup, seed=42 )
 
 ## Simulate index
 loca_reg[["index"]] <- gail_sim_index( loca_reg, tau=1.5, phi=0.05 )
 loca_irr[["index"]] <- gail_sim_index( loca_irr, tau=1.5, phi=0.05 )
 
 
 ## Assign cases and spatial unit
 gsa01 <- gail_sim_assign( loca_reg, loca_irr, loca_pop, seed=42 )
 
 

## End(Not run)

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