Description Usage Arguments Details Value See Also
For a specified statistic, performs a monte carlo simulation to obtain a distribution based on repeated allocation using gail.
1 2 |
sp_units |
Data frame of regular spatial units. |
cases |
Data frame containing the the cases. |
suid |
Column name in both |
num_cases |
Column name from |
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). |
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:
spat_fun = "moran"
will compute Moran's I using spdep::moran
.
spat_fun = "localmoran"
will compute the local Moran's I for each spatial unit using
spdep::localmoran
and return the vector of local Moran's I.
spat_fun = "localmoran_full"
will return the full results of spdep::localmoran
.
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:
dat_values
is a vector of numeric data representing the value (number of cases) for each spatial unit
nghb_list
is the neighborhood matrix, e.g. as returned by spdep::nb2listw
...
for extra arguments.
For example, the code of spat_fun
for Moran's I is: yyy
1 2 3 4 5 6 |
The return format depends on the nature of the output of spat_fun
.
If spat_fun
returns a scaler, gail_mc
returns a vector.
If spat_fun
returns a vector, gail_mc
returns an array.
If spat_fun
returns an array, gail_mc
returns a list.
gail
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.