Find the distribution of \(N(A)\) at \(T\) under the ETAS model. This can then be used to find the appropriate CDF to use as \(F\) in the randomized PIT transformation. We will look at the distribution at three pixels to judge the impact of edge effects.
source("../helper_functions.r")
source("../simetas.r")
mu <- 0.0392
b <- 2.5
K <- 0.456
c0 <- 0.0593
p <- 1.37
a <- 1.14
d <- 0.000103
q0 <- 1.67
M0 <- 3.0
endT <- 434
n_pixels <- 400
theta <- c(mu, b, K, c0, p, a, d, q0)
z <- simetas(theta, x1 = 1, y1 = 1, T = endT, sor=1)
Plot an example pattern and ID the three pixels that we will be monitoring.
plot(0, 0, type = "n", xlim = c(0, 1), ylim = c(0, 1), xlab = "x", ylab = "y", asp = 1)
points(z$lon, z$lat)
polygon_list <- pix_to_polygon(n_pixels, rw = c(0, 1, 0, 1))
polygon(polygon_list[[1]]$x, polygon_list[[1]]$y, col = "blue")
polygon(polygon_list[[64]]$x, polygon_list[[64]]$y, col = "red")
polygon(polygon_list[[190]]$x, polygon_list[[190]]$y, col = "green")
it <- 10000
NA_mat <- matrix(rep(NA, it * 3), ncol = 3)
for (i in 1:it) {
z <- simetas(theta, x1 = 1, y1 = 1, T = endT, sor=1)
cnts <- counts_in_pix(z$lon, z$lat, polygon_list)
NA_mat[i, 1] <- cnts[1]
NA_mat[i, 2] <- cnts[64]
NA_mat[i, 3] <- cnts[190]
}
barplot(table(NA_mat[,1]), main = "Corner pixel (blue)")
barplot(table(NA_mat[,2]), main = "In from corner pixel (red)")
barplot(table(NA_mat[,3]), main = "Center pixel (green)")
It appears that the distribution in the various pixels is fairly similar, so it should suffice to use only a single \(F\) for when calculating randomized PIT values for ETAS.