super_thin: Super-thinning

View source: R/nphawkes_functions.R

super_thinR Documentation

Super-thinning

Description

This function performs super-thinning to assess model fit. Thinning only can be executed by simply considering events of type "thin" or "retain", while superpositioning only can be executed by simply treating "thinned" points as "retained".

Usage

super_thin(
  K = "median_ci",
  model,
  method = "superthin",
  map = world,
  region = ".",
  sim_grid = TRUE,
  lat_lim = model$input$lat_lim,
  lon_lim = model$input$lon_lim
)

Arguments

K

a constant or character string that governs the amount of thinning and superposing that is implemented. Can be a constant value, the median, mean, minimum, or maximum conditional intensity: "median_ci", "mean_ci", "min_ci", or "max_ci", respectively.

model

the output from misd()

method

character string that defines residual analysis method as "superthin", "thin", or "superpose"

map

name of map provided by the maps package, defaults to maps::world

region

name of subregion to include, defaults to entirety of map

sim_grid

TRUE if geographical coordinates do not necessarily pertain to certain area, such as 0x1 by 0x1 grid, FALSE if using specific region or not using spatial information

lat_lim

vector containing minimum and maximum latitude bounds if sim_grid is TRUE

lon_lim

vector containing minimum and maximum longitude bounds if sim_gird is TRUE

Details

This function is to be used in conjunction with the misd() function from the nphawkes library.

To simulate spatial data, the user may define the map and region to easily simulate points within set political borders. This feature is not quite implementable, but may be soon. Otherwise, simulated points may be established when sim_grid = TRUE, based on minimum and maximum observed latitude and longitude coordinates.

Value

a data frame which includes the time, location, and estimated conditional intensity of events. The type of event, either observed or simulated, is noted along with the probability that the event was kept and whether or not the point was in fact retained.

Examples

data("hm.csv")
out = misd(dates = hm$t,
   ref_date = "1999-10-16",
   lat = hm$lat,
   lon = hm$lon,
   marks = hm$m,
   time_breaks = c(0,0.1, 0.5, 1,7,93,600),
   space_breaks = c(0,0.5, 1, 10, 25, 100),
   mark_breaks = c(3, 3.1,3.3, 4, 5, 8),
   just_times = T)
st = super_thin(K = "max_ci",
    model = out,
    method = "superthin",
    )


boydpe/nphawkes documentation built on March 31, 2022, 11:03 a.m.