gravatar

piotrowskif

Filip Piotrowski

Recently Published

Reimplementation of Ripley's K function using sf library
This report presents a reimplementation of Ripley’s K function and its simulation envelopes using the sf package in R, with the goal of transitioning point pattern analysis tools into the modern spatial data ecosystem. While spatstat remains the industry standard for such analyses, its outdated structure and limited integration with newer packages can be a barrier for contemporary users. The implementation described here reproduces the core functionality of spatstat::Kest() and spatstat::envelope() using simple features (sf) and base R methods. Although benchmark tests reveal that the custom functions are significantly less performant—mainly due to the computational overhead of distance calculations and CSR simulations—the approach emphasizes transparency and modularity. By avoiding black-box abstractions, the project provides valuable educational insight into the statistical and algorithmic foundations of spatial point pattern analysis.