-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathREADME.Rmd
More file actions
126 lines (98 loc) · 4.05 KB
/
README.Rmd
File metadata and controls
126 lines (98 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
message = FALSE
)
```
# Distance Based Measures of Spatial Structures <img src="man/figures/logo.png" align="right" alt="" width="120" />
<!-- badges: start -->
[](https://CRAN.r-project.org/package=dbmss)
[](https://CRAN.R-project.org/package=dbmss)
[](https://CRAN.R-project.org/package=dbmss)

[](https://app.codecov.io/github/EricMarcon/dbmss)
[](https://www.codefactor.io/repository/github/ericmarcon/dbmss)
<!-- badges: end -->
dbmss is an R package for simple computation of spatial statistic functions of distance to characterize the spatial structures of mapped objects, including classical ones (Ripley's *K* and others) and more recent ones used by spatial economists (Duranton and Overman's *Kd*, Marcon and Puech's *M*). It relies on spatstat for some core calculation.
## Installation
You can install the current release of the package from CRAN or the development version of dbmss from [GitHub](https://github.com/) with:
``` r
# install.packages("pak")
pak::pak("EricMarcon/dbmss")
```
## Main functions
The main functions of the package are designed to calculate distance-based measures of spatial structure.
Those are non-parametric statistics able to summarize and test the spatial distribution (concentration, dispersion) of points.
The classical, topographic functions such as Ripley's _K_ are provided by the _spatstat_ package and supported by _dbmss_ for convenience.
Relative functions are available in _dbmss_ only.
These are the $M$ and $m$ and $K_d$ functions.
The bivariate $M$ function can be calculated for _Q. Rosea_ trees around _V. Americana_ trees:
```{r m}
library(dbmss)
autoplot(
Mhat(
paracou16,
ReferenceType = "V. Americana",
NeighborType = "Q. Rosea"
),
main = ""
)
```
## Confidence envelopes
Confidence envelopes of various null hypotheses can be calculated.
The univariate distribution of _Q. Rosea_ is tested against the null hypothesis of random location.
```{r}
autoplot(
KdEnvelope(paracou16, ReferenceType = "Q. Rosea", Global = TRUE),
main = ""
)
```
Significant concentration is detected between about 10 and 20 meters.
## Maps
Individual values of some distance-based measures can be computed and mapped.
```{r}
# Calculate individual intertype M(distance) value
ReferenceType <- "V. Americana"
NeighborType <- "Q. Rosea"
fvind <- Mhat(
paracou16,
r = c(0, 30),
ReferenceType = ReferenceType,
NeighborType = NeighborType,
Individual = TRUE
)
# Plot the point pattern with values of M(30 meters)
p16_map <- Smooth(
paracou16,
fvind = fvind,
distance = 30,
# Resolution
Nbx = 512,
Nby = 512
)
par(mar = rep(0, 4))
plot(p16_map, main = "")
# Add the reference points to the plot
is.ReferenceType <- marks(paracou16)$PointType == ReferenceType
points(
x = paracou16$x[is.ReferenceType],
y = paracou16$y[is.ReferenceType],
pch = 20
)
# Add contour lines
contour(p16_map, nlevels = 5, add = TRUE)
```
## Vignettes
A quick [introduction](https://EricMarcon.github.io/dbmss/) is in `vignette("dbmss")`.
A [full documentation](https://ericmarcon.github.io/dbmss/articles/articles/reference.html) is available on the package website.
It is a continuous update of the paper published in the Journal of Statistical Software ([Marcon et al., 2015](https://doi.org/10.18637/jss.v067.c03)).
## Reference
Marcon, E., Traissac, S., Puech, F. and Lang, G. (2015). Tools to Characterize Point Patterns: dbmss for R.
*Journal of Statistical Software*. 67(3): 1-15.