{"id":16489511,"url":"https://github.com/rnuske/apcf","last_synced_at":"2025-10-07T04:12:17.994Z","repository":{"id":33981393,"uuid":"164135621","full_name":"rnuske/apcf","owner":"rnuske","description":"R Package providing the Adapted Pair Correlation Function","archived":false,"fork":false,"pushed_at":"2025-03-05T17:02:40.000Z","size":17880,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T22:42:05.877Z","etag":null,"topics":["geo","geos","point-pattern-analysis","r","r-package","spatial-statistics"],"latest_commit_sha":null,"homepage":"https://rnuske.github.io/apcf/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnuske.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-04T17:22:34.000Z","updated_at":"2025-03-05T17:00:43.000Z","dependencies_parsed_at":"2024-06-13T12:18:58.515Z","dependency_job_id":"6b8646d5-03ea-401a-bb0e-9aaaccbb8a9d","html_url":"https://github.com/rnuske/apcf","commit_stats":{"total_commits":116,"total_committers":4,"mean_commits":29.0,"dds":"0.12068965517241381","last_synced_commit":"d4fdcc8d757868377c977805d60fedafc30929d2"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnuske%2Fapcf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnuske%2Fapcf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnuske%2Fapcf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnuske%2Fapcf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnuske","download_url":"https://codeload.github.com/rnuske/apcf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244757788,"owners_count":20505479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geo","geos","point-pattern-analysis","r","r-package","spatial-statistics"],"created_at":"2024-10-11T13:44:22.468Z","updated_at":"2025-10-07T04:12:12.957Z","avatar_url":"https://github.com/rnuske.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# apcf: Adapted Pair Correlation Function\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/rnuske/apcf/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/rnuske/apcf/actions/workflows/R-CMD-check.yaml) \n[![Package-License](https://img.shields.io/badge/license-GPL--3-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-3.0.html) \n[![CRAN](https://www.r-pkg.org/badges/version/apcf)](https://cran.r-project.org/package=apcf) \n[![Dependencies](https://tinyverse.netlify.app/badge/apcf)](https://cran.r-project.org/package=apcf) \n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2535612.svg)](https://doi.org/10.5281/zenodo.2535612) \n\u003c!-- badges: end --\u003e\n\nThe apcf package provides a reimplementation of the Adapted Pair Correlation Function (Nuske et al. 2009) in C++. It relies heavily on the [GEOS library](https://libgeos.org) and is enabled by [Rcpp](https://www.rcpp.org).\n\nThe Adapted Pair Correlation Function transfers the concept of the pair correlation function (PCF) from point patterns to patterns of objects of finite size and irregular shape (eg. lakes within a country). The pair correlation function describes the spatial distribution of objects. It assesses whether patterns are random, aggregated or regularly spaced. The PCF is non-cumulative and, thus, particularly suitable to reveal critical scales of the pattern. \n\nThe following figure shows three simulated patterns (regular, random, clustered; from Nuske et al. 2009) to demonstrate the behavior of the PCF in three extreme cases (colored line: estimated function; white line: theoretical value of the function under the null hypothesis of complete spatial randomness; grey area: 95% confidence envelope under the null hypothesis, computed by Monte Carlo simulation using 199 replicates). \nUnder complete spatial randomness (CSR), *g(r) = 1*. Values *g(r) \u003c 1* suggest inhibition between objects and values *g(r) \u003e 1* suggest clustering.\n\n![](./man/figures/sim_pat_pcf.png)\n\n\u003c/br\u003e\n\n\n\n## Installation\nThe stable version can be installed from CRAN\n```r\ninstall.packages(\"apcf\")\n```\n\nand the development version is available from Github using the package `remotes`\n```r\nremotes::install_github(\"rnuske/apcf\")\n```\n\n\n## Usage\nThe main steps are (i) the construction of nullmodels by randomizing the objects of the original pattern within the study area, (ii) the edge correction by determining the proportion of a buffer within the study area, and (iii) the calculation of the shortest distances between the objects.\n\n```r\n# calculate distances between patches of original pattern and 3 nullmodels\n# number of nullmodels should by at least 199 and better yet 999\nds \u003c- pat2dists(area=sim_area, pattern=sim_pat_reg, max_dist=25, n_sim=3)\n\n# derive PCF and envelope from distances\npcf \u003c- dists2pcf(ds, r=0.2, r_max=25, stoyan=0.15, n_rank=1)\n\n# plot PCF\nplot(x=pcf, xlim=c(0, 20), ylim=c(0, 2.2))\n```\n\n\n## Requirements\nFor Unix-alikes GEOS (\u003e= 3.4.0) is required. On Ubuntu bionic (18.04) and beyond one can install the dependency simply with `sudo apt install libgeos-dev`. \n\n\n## References\nNuske, R.S., Sprauer, S. and Saborowski, J. (2009): Adapting the pair-correlation function for analysing the spatial distribution of canopy gaps. Forest Ecology and Management 259(1): 107–116. https://doi.org/10.1016/j.foreco.2009.09.050\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnuske%2Fapcf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnuske%2Fapcf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnuske%2Fapcf/lists"}