misd: Model Independent Stochastic Declustering

View source: R/nphawkes_functions.R

misdR Documentation

Model Independent Stochastic Declustering

Description

This function uses nonparametric procedures to analyze a Hawkes process in temporal or spatio-temporal domain, with or without marks through the Model independent stochastic declustering algorithm.

Usage

misd(
  dates,
  ref_date = min(dates),
  lat = rep(0, length(dates)),
  lon = rep(0, length(dates)),
  marks = rep(0, length(dates)),
  time_breaks = NULL,
  space_breaks = NULL,
  mark_breaks = NULL,
  stopwhen = 0.001,
  time_of_day = NA,
  just_times = FALSE,
  nonstat_br = FALSE,
  lon_lim = c(min(lon), max(lon), (max(lon) - min(lon))/10),
  lat_lim = c(min(lat), max(lat), (max(lat) - min(lat))/10),
  time_unit = "day",
  dist_unit = "mile",
  show_progress = FALSE
)

Arguments

dates

a vector of dates as "yyyy-mm-dd".

ref_date

a date to serve as time 0, defaults to earliest observation

lat

a vector of latitudes, omit if not using spatial data

lon

a vector of longitudes, omit if not using spatial data

marks

a vecotr of marks, or magnitudes, omit if not using marked data

time_breaks

a vector of cutoff values for temporal bins of time differences

space_breaks

a vector of cutoff values for spatial bins of distance differences

mark_breaks

a vector of cutoff values for magnitude bins

time_of_day

character string that lists the time of day of events, as hour:minute:second

time_unit

character string that specifies the desired unit of time

dist_unit

character string that specifies the desired unit of distance: meter, kilometer, or mile

show_progress

when TRUE, algorithm will print the iteration number and maximum pairwise change in the probability matrix.

just_time

TRUE or FALSE object. TRUE if dates object is a vector of only times, indicating time elapsed since beginning of catalog.

stop_when

scalar that serves as conversion criterion, 1e-3 as default

Details

This function can only be applied to data that contains a temporal feature. It can also be applied to data consisting of time and space, time and marks, or time and space and marks.

For each triggering component used (time, space, marks), a binning structure will be applied. The user may define these right continuous bins as a vector (c(1,5,10) creates two bins for 1 < x ≤ 5, and 5 < x ≤ 10), or 11 time bins may be generated automatically by specifying time_quantile = n, with the same applying for marks and space. This method will establish breaks such that the allocation of time differences will be assigned on the log scale, creating smaller bins close to 0 and larger bins at greater time or space differences.

If no time of day is provided, events will be randomly assigned a time during the event's date.

Value

Probability matrix p0 containing the probabilities that event i is an offspring of event j, i > j. Diagonal elements represent the probability that event i is a background event.

g is a vector of the estimated values for each bin of the temporal triggering component

h is a vector of the estimated values for each bin of the spatial triggering component

k is a vector of the estimataed values for each bin of the magnitude triggering component

br is the estimated background rate of the process

perc_diag is the proportion of mass lying on the diagonal of matrix p0

perc_br is the proportion of events in which the maximum probabilistic assignment is as a background event

time_bins is a matrix containing the temporal bin of each pair of events

dist_bins is a matrix containing the spatial bin of each pair of events

mark_bins is a vector containing the magnitude bin of each event

n_iterations is the number of iterations executed until convergence

locs is a data frame listing midpoint latitude, midpoint longitude, x and y index, and background rate of the pixel each event lies in, for nonstationary background rate

x_pix is a vector of midpoints of the x, or longitude, pixels

y_pix is a vector of midpoints of the y, or latitude, pixels

input is a list of all inputs

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)

 out1 = 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_quantile = 7,
   mark_breaks = c(3, 3.1,3.3, 4, 5, 8),
   just_times = T,
   nonstat_br = T)

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