Description Usage Arguments Details Value Author(s) References Examples

The `fgrand`

function produces sets of randomized observations or indices using the Floating Grid Method, which is a method for spatially restricted randomizations. `fgrm`

offers additional functionality to manipulate observations within grid cells, for instance observations could be scaled with grid cells.

1 2 |

`xy` |
Two-column matrix with the geographical locations of observations. |

`z` |
Vector with the observations. If left empty |

`scale` |
Value indicating the spatial scale of the randomizations. |

`group` |
Optional group membership of observations. |

`iter` |
Number of iterations for every grid cell size. Default is 999. Note that in order to produce a probability an observation is assigned to any of the geographical locations is a negative function of the distance between its original and assigned location many iterations are needed. |

`ratio` |
The ratio between the sides of the grid cells. Default is 1. |

`FUN` |
Function to perform randomizations. Note that the function must be able to randomize one value, which is for instance a issue if using |

`FUN.mani` |
Function to perform manipulations of the observations within grid cells. This functionality should be used together with |

`...` |
Optional arguments to |

`marks` |
Should either be left empty, be a vector or a matrix. When |

`add.obs` |
If |

`as.matrix` |
If |

Before using those functions please read the reference or vignette. Alternatively use the more user-friendly function `fgm`

. If there are missing values for the observations, leave `z`

empty and enter the observations as `marks`

in the `cal.stat`

function.

`fgrand`

returns a `list`

or a `matrix`

, depending on the setting of argument `as.matrix`

.

Reinder Radersma

Reinder Radersma & Ben C. Sheldon, 2014. A new permutation test for dealing with and exploring spatial autocorrelation submitted to MEE

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 | ```
## 200 random geographical locations
xy <- array(runif(400,0,2), dim=c(200,2))
## run fgrand to produce 99 randomizations for scale 1
test <- fgrand(xy, scale=1, iter=99, add.obs=TRUE)
## run fgrand to produce 99 bootstraps for scale 1
test <- fgrand(xy, scale=1, iter=99, FUN=function(x){x[sample.int(length(x),replace=TRUE)]}, add.obs=TRUE)
## 200 times 200 random distances (e.g. genetic relatedness between mated pairs)
trait <- array(rnorm(200*200,0.6,0.1), dim=c(200,200))
## make the observed pairs more alike
diag(trait) <- diag(trait)+0.02
## make two rows and two colums empty
trait[,3] <- NA
trait[,50] <- NA
trait[6,] <- NA
trait[12,] <- NA
## calculate means; will give NAs because there are missing values
calc <- cal.stat(test,trait,mean)
## calculate means
calc <- cal.stat(test,trait,mean, na.rm=TRUE)
## plot means
hist(calc)
abline(v=calc[1], col="red", lwd=2)
``` |

FGM documentation built on May 2, 2019, 4:51 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.