# fgm: Floating Grid Method In FGM: Floating Grid Method

## Description

The Floating Grid Method is a spatially restricted permutation technique. Please read the reference mentioned below before using this function. This particular function can be used to perform permutation tests which make use of the Floating Grid permutation technique

## Usage

 `1` ```fgm(xy, group=1, marks, iter=999, ratio=1, scale.seq=seq(from=0, to=max(dist(xy)), length.out=21)[2:21], bootstrap=FALSE, correlate=FALSE) ```

## Arguments

 `xy` Geographical locations of observations. `group` Group membership for the observations. `group` is optional. `marks` Should be a vector containing all observations, a two-column matrix containing two paired observations or a squared matrix containing relationships or distances between all observations (such as genetic relatedness or distance).The latter is a way to perform multivariate analyses. Note that the squared matrix does not need to be symmetrical: for instance, the genetic relatedness between paired individuals can be investigated by using males as columns and females as rows. `NA`s are allowed. `iter` Number of iterations for every grid cell size. Default is 999, though it is adviseable to perform 9999 interations for the final results. `ratio` The ratio between the sides of the grid cells. Default is 1. `scale.seq` Sequence of all grid cell sizes that will be tested. The number, order and values of this sequence are completely free, as long as they are numeric. Default is 20 equaly spaced out grid cell sizes from slightly larger than 0 to the maximum distance between any two individuals. Use the `explore.fgm` function to make a informed decision on the right sequence of grid cell sizes. `bootstrap` `TRUE` if observations should to be drawn with replacement, `FALSE` if not. Default is `FALSE`. `correlate` If one wants to compare two paired observations `correlate` should be the method of correlation with the FGM should use as available in `cor.test`; so `"pearson"`, `"kendall"` or `"spearman"`. If `marks` is not a two-column matrix `correlate` should be `FALSE`. Default is `FALSE`.

## Value

`fgm` returns an object of `class` "fgm", which can be accessed with the functions `summary` and `plot`.

## References

Reinder Radersma & Ben C. Sheldon, 2014. A new permutation test to explore and control for spatial autocorrelation in point pattern data. Manuscript submitted to MEE

`cor.test`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```## Produce 20 geographical locations. loc.x <- 1:20 loc.y <- runif(20,0,5) ## Produce 2 x 20 phenotypes. type1 <- 11:30+runif(20,0,5) type2 <- 11:30+runif(20,0,5) fg <- fgm(xy=cbind(loc.x,loc.y), marks=cbind(type1,type2), iter=99, correlate="pearson") summary(fg) plot(fg) ```