Movatterモバイル変換


[0]ホーム

URL:


Type:Package
Title:Spatial Association of Different Types of Polygon
Version:0.8.0
Date:2024-10-02
Description:In ecology, spatial data is often represented using polygons. These polygons can represent a variety of spatial entities, such as ecological patches, animal home ranges, or gaps in the forest canopy. Researchers often need to determine if two spatial processes, represented by these polygons, are independent of each other. For instance, they might want to test if the home range of a particular animal species is influenced by the presence of a certain type of vegetation. To address this, Godoy et al. (2022) (<doi:10.1016/j.spasta.2022.100695>) developed conditional Monte Carlo tests. These tests are designed to assess spatial independence while taking into account the shape and size of the polygons.
License:GPL (≥ 3)
Encoding:UTF-8
SystemRequirements:GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>= 4.8.0)
Imports:sf, methods, stats
Depends:R (≥ 4.0)
URL:https://github.com/lcgodoy/sapo/
BugReports:https://github.com/lcgodoy/sapo/issues/
RoxygenNote:7.3.2
Language:en-US
Suggests:knitr, rmarkdown
VignetteBuilder:knitr
NeedsCompilation:no
Packaged:2024-10-08 22:13:31 UTC; lcgodoy
Author:Lucas da Cunha GodoyORCID iD [aut, cre]
Maintainer:Lucas da Cunha Godoy <lcgodoy@duck.com>
Repository:CRAN
Date/Publication:2024-10-11 08:20:02 UTC

h_{12}(t) from matrix

Description

Computes theh_{12} (K or L) based on a distance matrixbased on a method

Usage

calc_h(x, var_st = FALSE, dists = NULL)

Arguments

x

distance matrix

var_st

logical scalar indicating if the L function should be usedinstead

dists

vector of distances to computeh_{12}(t).

Value

a numeric vector


Polygons Spatial Association Test - Global Envelope

Description

A Monte Carlo test to verify if two sets of polygons areassociated based in a global envelope of the functionsK_{12}(d) andL_{12}(d) using different test statistics.

Usage

cmc_psat(  p1,  p2,  id_col = NULL,  n_sim = 499L,  alpha = 0.01,  var_st = TRUE,  ts = "SMAD",  distances = NULL,  hausdorff = TRUE,  method = "rnd_poly")

Arguments

p1

asf object containing one column specifying the objectsid.

p2

asf object containing one column specifying the objectsid.

id_col

acharacter orinteger indicating the column ofp1 storing the unique identifier for the polygons/sample units.

n_sim

aninteger corresponding to the number of Monte Carlosimulations for the test

alpha

anumeric indicating the confidence level.

var_st

use the variance stabilizing funciton?

ts

acharacter associated to a test statistic. Inputs acepted:c('IM', 'MAD', 'SIM', 'SMAD', 'IMDQ', 'MADDQ').

distances

anumeric vector indicating the distances toevaluateH(d). IfNULL then the range considered goes from 5%to 20% of the max distance that can be observed inside the study region.

hausdorff

alogical scalar indicating whether the Hausdorffdistance should be used (default is TRUE).

method

(default = "rng_poly") acharacter indicating themethod used to deal with broken polygons in the Toroidal Shift. Validoptions arec("min", "max", "mean", "rnd_poly", "rnd_dist", "min_norm", "max_norm", "hybrid", "hyb_center", "hybrid_nc", "old_min").

Value

alist with values:

p_value

anumeric scalar giving the p-value of the test

mc_sample

anumeric vector giving the test statistic for each of the Monte Carlo simulations

mc_funct

amatrix where each line correspond to the function (K orL) estimatedfor the Monte Carlo simulations

distances

numeric vector containing the distances where mc_func were evaluated.

alpha

anumeric scalar giving the significance level

rejects

alogical scalar, TRUE if the null hypothesis is reject

Examples

library(sapo)library(sf)set.seed(2024) ## loading toy datapoly1 <- system.file("extdata", "poly1.rds", package = "sapo") |>  readRDS()poly2 <- system.file("extdata", "poly2.rds", package = "sapo") |>  readRDS()my_ht <- cmc_psat(poly1, poly2, n_sim = 199)my_ht$p_value

Create jumps for random movements

Description

Create jumps for random movements

Usage

create_jump(unique_bb)

Arguments

unique_bb

a bbox shared between both "Polygon Patterns"

Details

This is an internal function.

Value

asfc object representing a random jump or shift.

Author(s)

Lucas Godoy


Fix distance matrix containing broken polygons

Description

fix a polygons' distance matrix based on a given method. Thisfunction assumes the polygon that has been broken is represented by therows of the distance matrix.

Usage

fix_dist(x, method = "rnd_poly")

Arguments

x

distance matrix

method

method used to fix. The options are "min", "max", "mean","rnd_poly", "rnd_dist", "min_norm", "max_norm", "hybrid", "hyb_center","hybrid_nc", "old_min"

Value

a distance matrix


h_{12}(t) from polygons

Description

Computes theh_{12} (K or L) based on a distance matrixbased on a method

Usage

h_func(  p1,  p2,  hausdorff = TRUE,  method = "rnd_poly",  var_st = FALSE,  dists = NULL)h_func.list(x, ...)

Arguments

p1

sf object

p2

sf object

hausdorff

logical parameter indicating whether the Hausdorff distanceshould be used

method

method to deal with broken polygons

var_st

logical scalar indicating if the L function should be usedinstead

dists

vector of distances to computeh_{12}(t).

x

a list with two sf objects.

...

Parameters to be used withh_func when inputting a list.

Value

a numeric vector


ID aware distance matrix

Description

Distance between polygons accounting for toroidal shift.

Usage

iadist(p1, p2, hausdorff = TRUE, method = "rnd_poly")

Arguments

p1

asf object containing one column specifying the objectsid.

p2

asf object containing one column specifying the objectsid.

hausdorff

logical scalar indicating whether the Hausdorffdistance should be used.

method

method for "fixing" the distance matrix.

Value

a distance matrix.

Author(s)

Lucas Godoy


Integram Measure

Description

Integram Measure

Usage

im(x, h = 1)

Arguments

x

numeric matrix

h

numeric

Value

numeric vector


Integram Measure with Assimetry Correction

Description

Integram Measure with Assimetry Correction

Usage

im_ac(x, h = 1)

Arguments

x

numeric matrix

h

numeric

Value

numeric vector


Maximum Absolute Deviation

Description

Maximum Absolute Deviation

Usage

mad(x)

Arguments

x

numeric matrix

Value

numeric vector


Maximum Absolute Deviation with Assimetry Correction

Description

Maximum Absolute Deviation with Assimetry Correction

Usage

mad_ac(x)

Arguments

x

numeric matrix

Value

numeric vector


auxiliary mean

Description

aux function to calculate the mean of a vector when removing each of itselements one by one.

Usage

mean_aux(x)

Arguments

x

a numeric vector

Value

a numeric vector

Author(s)

Lucas Godoy


Pre-TS

Description

Create rigid copies of a polygon. This function an auxilliaryfunction for the Toroidal Shift method

Usage

pre_ts(poly, bb = NULL, id_col = NULL)

Arguments

poly

an object of classsf orsfc.

bb

(optional) a unique bounding box.

id_col

acharacter indicating the id column inpoly.

Value

ansf with 8 additional rigid copies ofpoly.

Author(s)

Lucas Godoy


Studentized Integram Measure

Description

Studentized Integram Measure

Usage

s_im(x, h = 1)

Arguments

x

numeric matrix

h

numeric

Value

numeric vector


Studentized Maximum Absolute Deviation

Description

Studentized Maximum Absolute Deviation

Usage

s_mad(x)

Arguments

x

numeric matrix

Value

numeric vector


sapo: Spatial Association of Polygon Types

Description

sapo: Spatial Association of Polygon Types


Toroidal Shift

Description

Toroidal Shift

Usage

toroidal_shift(x, y, shifted = FALSE, unique_bb = NULL)

Arguments

x

asf orsfc object. Itsgeometry may contain POLYGONS and/orPOINTS.

y

asf orsfc object. Itsgeometry may contain POLYGONS and/orPOINTS.

shifted

logical indicating whetherx has been "shifted". Thisparameter is mainly for internal use and testing.

unique_bb

a bbox shared between both "Polygon Patterns"

Value

a list

Author(s)

Lucas Godoy


Translate ansf object by a "point"

Description

Translate ansf object by a "point"

Usage

translate_by_pt(pt, poly)

Arguments

pt

sfc representing a shift.

poly

sfc ofsf to be shifted

Value

asf orsfc representingpoly shifted bypt

Author(s)

Lucas Godoy


[8]ページ先頭

©2009-2025 Movatter.jp