`R/DataPreparation.R`

`spatialcor_dist.Rd`

Figure to see spatial autocorrelation that may allow to define the grid size for gridded procedure. Two figures are produced with different distance step.

spatialcor_dist( x, y, longlat = FALSE, max1, lag1, max2, lag2, binomial = TRUE, thd = TRUE, plot = TRUE, saveWD, figname, simplify.grid = FALSE )

x | A SpatialPointsDataFrame |
---|---|

y | The column number on which to calculate correlation. Otherwise a column should be names "dataY" |

longlat | logical. longlat data or not. Default to FALSE |

max1 | Numeric. maximum distance of panel 1 in meters. Default to max distance divided by 3. |

lag1 | Numeric. step distance for calculating autocorrelation in meters. Default to max1/100. |

max2 | Numeric. maximum distance of panel 1 in meters. Default to max1/10. |

lag2 | Numeric. step distance for calculating autocorrelation in meters. Default to max2/100. |

binomial | Logical. Presence-absence data (TRUE) or continuous data (FALSE). |

thd | logical. If TRUE, the function suggest a distance threshold according to breakpoint in correlation. This is only a suggestion. nls function is used. |

plot | Logical. |

saveWD | directory where to save the output figure. If null, figure appears on screen. |

figname | character. If saveWD is not empty, you can specify the name of the output figure (without extension). Default to "Correlogram". |

simplify.grid | logical. If dataset is too big, it will be difficult to calculate all distances between all points. A simplification is to divide the area into a grid and calculate distances and correlation in each cell of the grid separately. Results are then merged. Grid used depends on the largest of max1 and max2 values. If less than 10 values, there are randomly merged with another cell |

A figure of correlation is showed or saved (in saveWD). A threshold is suggested if thd=TRUE