stp_learner {stppSim}R Documentation

Learning the spatiotemporal properties of a sample data

Description

Learns both the spatial and the temporal properties of a real sample dataset.

Usage

stp_learner(ppt, start_date = NULL, poly = NULL,
n_origin=50, p_ratio, gridSize = 150, s_range =  150,
tolerance = 0.07,
crsys = NULL, show.plot = FALSE)

Arguments

ppt

A 3-column matrix or list containing x - eastings, y - northing, and t - time of occurrence (in the format: ‘yyyy-mm-dd’).

start_date

the start date of the temporal pattern. The date should be in the format "yyyy-mm-dd". The temporal pattern will normally cover 1-year period.

poly

(An sf or S4 object) a polygon shapefile defining the extent of the landscape

n_origin

number of locations to serve as origins for walkers. Default:50.

p_ratio

(an integer) The smaller of the two terms of a Pareto ratio. For example, a value of 20 implies a 20:80 Pareto ratio.

gridSize

the size of square grid to use for discretizing the space. Default is: 150.

s_range

A value (in metres), not less than 150, specifying the maximum range of spatial interaction across the space. For example, for 150m, the intervals of spatial interactions are created as (0, 50], (50 - 100], and (100-150], representing the "small", "medium", and "large", spatial interaction ranges, respectively. If s_range is set as NULL, simulation focusses only on generating point pattern with similar spatiotemporal patterns as the sample dataset.

tolerance

Pvalue to use for the extraction of space-time interaction in the sample data. Default value: 0.07.

crsys

(string) the EPSG code of the projection system of the ppt coordinates. This only used if poly argument is NULL. See "http://spatialreference.org/" for the list of EPSG codes for different regions of the world. As an example, the EPSG code for the British National Grid projection system is: "EPSG:27700".

show.plot

(TRUE or FALSE) Whether to show some displays.

Details

Returns an object of the class real_spo, storing details of the spatiotemporal properties of the sample data learnt.

Value

an object (list) containing specific spatial and temporal properties of a sample dataset.

References

Silverman, B.W., 2018. Density estimation for statistics and data analysis. Routledge.

Examples

## Not run: 
#Goal: To learn the ST properties
#of a sample data, for the purpose of
#simulating the full dataset (see `psim_real`).
data(camden_crimes)
#subset 'theft' crime
theft <- camden_crimes[which(camden_crimes$type ==
"Theft"),1:3]
#specify the proportion of full data to use
sample_size <- 0.3
set.seed(1000)
dat_sample <- theft[sample(1:nrow(theft),
round((sample_size * nrow(theft)), digits=0),
replace=FALSE),]
#plot(dat_sample$x, dat_sample$y) #preview

stp_learner(dat_sample,
start_date = NULL, poly = NULL, n_origin=50,
p_ratio=20, gridSize = 150,
s_range =  150, tolerance = 0.07,
crsys = "EPSG:27700",
show.plot = FALSE)

## End(Not run)

[Package stppSim version 1.3.4 Index]