Spatial Statistics in R
Barry Rowlingson

https://www.datacamp.com/courses/spatial-statistics-in-r


point-pattern analysis
感觉挺有用的

```{r}
# The number of points to create
n <- 200

# Set the range
xmin <- 0
xmax <- 1
ymin <- 0
ymax <- 2

# Sample from a Uniform distribution
x <- runif(n, xmin, xmax)
y <- runif(n, ymin, ymax)
```

```{r}
# See pre-defined variables
ls.str()

# Plot points and a rectangle

mapxy <- function(a = NA){
  plot(x, y, asp = a)
  rect(xmin, ymin, xmax, ymax)
}

mapxy(1)
```

```{r}
# Load the spatstat package
library(spatstat)

# Create this many points, in a circle of this radius
n_points <- 300
radius <- 10

# Generate uniform random numbers up to radius-squared
r_squared <- runif(n_points, 0, radius^2)
angle <- runif(n_points, 0, 2*pi)

# Take the square root of the values to get a uniform spatial distribution
x <- sqrt(r_squared) * cos(angle)
y <- sqrt(r_squared) * sin(angle)

plot(disc(radius)); points(x, y)
# disc(radius) 就是画个圈
```

书签
https://campus.datacamp.com/courses/spatial-statistics-in-r/introduction-1eb0e83b-2b58-4e56-8d7e-ccde3fbee5d7?ex=6

我感觉和
Spatial Econometrics R 不相关