gail_sim_pop: Simulate Population for GAIL

Description Usage Arguments Details See Also Examples

Description

Function for the simulation framework in GAIL. Create a simulated population distributed across the spatial domain. This population can be sampled to create cases, and to create individuals reporting the irregular spatial unit using gail_sim_assign.

Usage

1
2
gail_sim_pop(units_reg, units_irr, method = "uniform", npop = 1e+05,
  beta_setup = NULL, seed = NULL)

Arguments

units_reg

Set of regular spatial units (cases get allocated to this set).

units_irr

Set of irregular spatial units (cases get allocated from this set).

method

Method of simulating population: 'uniform' or 'beta'. See details.

npop

Size of population to simulate.

beta_setup

If method='beta', a data.frame describing how to distribute the locations. See details.

seed

If given, sets the seed for the RNG.

...

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

Details

For method='uniform' points are simulated uniformly across the 100x100 spatial domain. For method='irregular' then three additional parameters are necessary: A list of centers, and a list of values for alpha and beta. For each center, points are simulated from a beta distribution.

The argument beta_setup sets the parameters for the beta method of distributing the population. This can be used to generate a population which is clustered in certain areas. Thise should be a data.frame (or comprable object) with columns: nn, mx, my, sx, sy. These columns represent the number of individuals in the cluster (nn). The cluster is centered at the point (mx, my), while sx and sy are the standard deviation in the x and y dimensions, respectively. In one dimension, the cluster will be drawn from a beta distribution (scaled to [0, 100]) with mean of mx and standard deviation of sx. The α and β parameters of the beta distribution are derived from the mean and standard deviation.

See Also

gail_sim_regions, gail_sim_rate, 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
35
36
37
38
39
40
41
## 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="irregular", nedge=6 , seed=42 , P=-20, Q=20 )
 
 ## 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_irr, loca_irr, method="beta", 
                           beta_setup=beta_setup, seed=42 )
 

## End(Not run)

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