library(actR)
  library(lipdR)
  library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
  library(purrr)
#Get some data from the 4.2 paper
googlesheets4::gs4_deauth()
sites <- googlesheets4::read_sheet("1ReehV_sHCOwMalaFE_5NJyANEPih_nT0tBIQO1IeHak")
#>  Reading from North Atlantic 8.2 datasets.
#>  Range tp.

#download the corresponding data
northAtlanticData <- readLipd(sites$datasetId)
#> Getting version information from lipdverse
#>  ■■■■                               9% |  ETA: 18s
#>  ■■■■■■■■■■                        29% |  ETA: 12s
#>  ■■■■■■■■■■■■■■■■■                 52% |  ETA:  7s
#>  ■■■■■■■■■■■■■■■■■■■■■■■           75% |  ETA:  4s
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■    98% |  ETA:  0s
#> Downloading 56 datasets from lipdverse.org...
#>  ■■■■■■■■■■■■                      36% |  ETA:  5s
#>  ■■■■■■■■■■■■■■■■■■■■■■■           75% |  ETA:  2s
#> 13 datasets failed to download. You are missing the following datasetIds: 
#> bQiFhmYqfDQYHieKVj0i;
#> 9SDxMaDXFyjWdPjuKI64;
#> 0AJ33PLgsJrFky9NUGbn;
#> DId13FkBr72Wt2xxUa17;
#> RpZHOFgjuo3Fp5c970uw;
#> LCaeacaef339edf8f4c197d8cafa76a9a3;
#> LCca058f3bae1e7af76e937aef9a000e5a;
#> LC27e1e6bc4549384bf977adb3dfb9e9c9;
#> gRdh3ytex5bT7S382Zty;
#> hFVbfl82Y0TyYxpnYF5U;
#> d5alYnHV94FdUshgmIEp;
#> H2J5zba36ZMTsvg89TV9;
#> TVIdcLPFJRk1jlKVYXUG
#> 
#> [1] "Loading 43 datasets from /tmp/Rtmp8kDvMg/lpdDownload..."
#>   |                                                                              |                                                                      |   0%  |                                                                              |==                                                                    |   2%  |                                                                              |===                                                                   |   5%  |                                                                              |=====                                                                 |   7%  |                                                                              |=======                                                               |   9%  |                                                                              |========                                                              |  12%  |                                                                              |==========                                                            |  14%  |                                                                              |===========                                                           |  16%  |                                                                              |=============                                                         |  19%  |                                                                              |===============                                                       |  21%  |                                                                              |================                                                      |  23%  |                                                                              |==================                                                    |  26%  |                                                                              |====================                                                  |  28%  |                                                                              |=====================                                                 |  30%  |                                                                              |=======================                                               |  33%  |                                                                              |========================                                              |  35%  |                                                                              |==========================                                            |  37%  |                                                                              |============================                                          |  40%  |                                                                              |=============================                                         |  42%  |                                                                              |===============================                                       |  44%  |                                                                              |=================================                                     |  47%  |                                                                              |==================================                                    |  49%  |                                                                              |====================================                                  |  51%  |                                                                              |=====================================                                 |  53%  |                                                                              |=======================================                               |  56%  |                                                                              |=========================================                             |  58%  |                                                                              |==========================================                            |  60%  |                                                                              |============================================                          |  63%  |                                                                              |==============================================                        |  65%  |                                                                              |===============================================                       |  67%  |                                                                              |=================================================                     |  70%  |                                                                              |==================================================                    |  72%  |                                                                              |====================================================                  |  74%  |                                                                              |======================================================                |  77%  |                                                                              |=======================================================               |  79%  |                                                                              |=========================================================             |  81%  |                                                                              |===========================================================           |  84%  |                                                                              |============================================================          |  86%  |                                                                              |==============================================================        |  88%  |                                                                              |===============================================================       |  91%  |                                                                              |=================================================================     |  93%  |                                                                              |===================================================================   |  95%  |                                                                              |====================================================================  |  98%  |                                                                              |======================================================================| 100%
#> 
#> [1] "Successfully loaded 43 datasets, with 0 failure(s)."

#create a timeseries tibble
nats <- as.lipdTsTibble(northAtlanticData)

#filter down to just the data we want
filtNats <- nats |> 
filter(paleoData_TSid %in% sites$paleoData_TSid)
#look for the 8.2 ka event at these sites:

tp <- split(filtNats,seq(nrow(filtNats)))


test <- detectExcursion(tp[[1]],
                  event.yr = 8200,
                  event.window = rnorm(50,400,100),
                  ref.window = rnorm(50,400,100),
                  exc.type = "negative",
                  n.ens = 50,
                  sig.num = rnorm(50,2,.1),
                  n.consecutive = sample(c(2,3,4),size = 50,replace = TRUE),
                  null.hypothesis.n = 50,
                  simulate.time.uncertainty = FALSE,
                  simulate.paleo.uncertainty = TRUE,
                  paleo.uncertainty = 0.2,
                  min.vals = 4,
                  paleo.ar1 = 0.8)
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■

events8.2 <- purrr::map(tp,
                  detectExcursion,
                  event.yr = 8200,
                  event.window = rnorm(50,400,100),
                  ref.window = rnorm(50,400,100),
                  exc.type = "negative",
                  n.ens = 50,
                  sig.num = rnorm(50,2,.1),
                  n.consecutive = sample(c(2,3,4),size = 50,replace = TRUE),
                  null.hypothesis.n = 50,
                  simulate.time.uncertainty = FALSE,
                  simulate.paleo.uncertainty = TRUE,
                  paleo.uncertainty = 0.2,
                  min.vals = 4,
                  paleo.ar1 = 0.8,
                  .progress = TRUE) |> 
  purrr::list_rbind() |> 
  dplyr::filter(!is.na(pvalue))
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6m
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■                                 5% |  ETA:  6m ■■■■■■■■■■■■■■■■■■                57% |  ETA:  5m
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■                57% |  ETA:  5mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■                57% |  ETA:  5mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■                57% |  ETA:  5m ■■■■■■■■■■■■■■■■■■■■■             67% |  ETA:  4m
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■             67% |  ETA:  4mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■             67% |  ETA:  4mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■             67% |  ETA:  4mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■             67% |  ETA:  4mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■             67% |  ETA:  4m ■■■■■■■■■■■■■■■■■■■■■■■■■         81% |  ETA:  2m
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■         81% |  ETA:  2mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■         81% |  ETA:  2m ■■■■■■■■■■■■■■■■■■■■■■■■■■■       86% |  ETA:  2m
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■■■       86% |  ETA:  2mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■■■       86% |  ETA:  2mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■■■       86% |  ETA:  2mTesting null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#> Testing null hypothesis with 50 simulations, each with 50 ensemble members. ■■■
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■■■       86% |  ETA:  2m

lon.range <- range(events8.2$geo_longitude) + c(-5,5)
lat.range <- range(events8.2$geo_latitude) + c(-5,5)

dist.grid <- distanceGrid(events8.2,lon.range = lon.range,lat.range = lat.range,grid.resolution = 3)


pval.grid.weight.temp <- map(dist.grid,
                             spatialSigTest,
                             events=events8.2,
                             agg.method="robustNull",
                             use.weights = TRUE,
                             distance.cutoff = 1000,
                             .progress = TRUE)
#>  ■■■■■■■■■■■■                      35% |  ETA:  5s
#>  ■■■■■■■■■■■■■■■■■■                56% |  ETA:  4s
#>  ■■■■■■■■■■■■■■■■■■■■■■■■          77% |  ETA:  3s
#>  ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■    98% |  ETA:  0s

make a map!

    figoutTemp <- plotSignificance(pval.grid.weight.temp,
                                   sigTestResults = events8.2,
                               which.test = "pvalNeg",
                               color.breaks = c(0.01,0.05,0.1,0.2),
                               restrict.sites = TRUE,
                               alpha.by.weight = TRUE,
                               cutoff.distance = 1000,
                               x.lim = lon.range,
                               y.lim = lat.range)

figoutTemp$plot