gail_mc: Monte Carlo Estimation of Variability from GAIL

Description Usage Arguments Details Value See Also

Description

For a specified statistic, performs a monte carlo simulation to obtain a distribution based on repeated allocation using gail.

Usage

1
2
gail_mc(sp_units, cases, suid, num_cases, max_dist, RAP = gail_rap,
  unit_value = "m", spat_fun, nsim = 10, seed = NULL, ...)

Arguments

sp_units

Data frame of regular spatial units.

cases

Data frame containing the the cases.

suid

Column name in both cases which contains the spatial unit identification / name.

num_cases

Column name from cases containing the number of cases, see details.

max_dist

The maximum distance at which two locations can be considered neighbors.

RAP

Function to be used for calculating assignment probabilities, see details.

unit_value

The units of distance, default to meters. See units::set_units.

spat_fun

A function to compute the statistic of interest over the spatial units. Can also accept "moran", "localmoran", and "localmoran_full".

nsim

The number of Monte Carlo replications to run.

seed

If given, sets the seed for the RNG.

...

Space for additional arguments (e.g., for gail).

Details

Most of the arguments are passed to the gail arguments of the same names. They are included (instead of using ...) to facilitate understanding this function.

The spat_fun argument performs some computation on the dataset. Currently built-in options are:

The monte carlo simulation repeatedly re-allocates the cases to the regular spatial units. For each allocation, the result from the argument spat_fun is saved. This could be a scaler (e.g., Moran's I), a vector (e.g. local Moran's I), or something more complex.

A custom function for spat_fun should take the arguments:

1
2
3
4
5
6
   spat_fun <- function( dat_values, nghb_list, ... ){
       spdep::moran( x     = dat_values,
                     listw = nghb_list,
                     n     = length(dat_values),
                     S0    = spdep::Szero(nghb_list), ...)$I
    }

Value

The return format depends on the nature of the output of spat_fun.

See Also

gail


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