get_all_neib_vals: Get the spatio-temporal neighbourhoods of all observations

Description Usage Arguments Details Value References See Also

View source: R/st_indicators.R

Description

Get the spatio-temporal neighbourhoods of all observations

Usage

1
2
get_all_neib_vals(df, max_radius, t_dist_mat, s_dist_mat, alpha, vars,
  time_id, site_id, parallel = FALSE, nsplits = 4)

Arguments

df

a data frame of observations

max_radius

the maximum spatio-temporal distance allowed to be included in a neighbourhood

t_dist_mat

a matrix of normalized temporal distances between time-stamps (rownames and colnames should be a concatenation of "TIME_" and the time-stamp)

s_dist_mat

a matrix of normalized spatial distances between locations (rownames and colnames should be a concatenation of "SITE_" and the location IDs)

alpha

a weighting factor for the spatio-temporal distance

vars

Vector of character strings indicating the columns whose values should be retrieved

time_id

the name of the column containing time-stamps

site_id

the name of the column containing location IDs

parallel

Boolean indicating whether the code should run in parallel. Default is FALSE

nsplits

Number of subsets of rows to split the data frame into so they can be processed in parallel

Details

The spatio-temporal distance is defined as

D_{i,j} = d_{i,j} x α + t_{i,j} x (1-α)

where d_i,j is the spatial distance between locations, t_i,j is the temporal distance between time-stapms and α is a weighting factor. Note that the radius should always be a number between zero and min(alpha, alpha-1). Also note that if alpha is set to 1, then instead of a cone, the neighbourhood will have the shape of a cylinder.

Value

A data frame where each row describes a neighbour, with the first two columns containing the location ID and time-stamp of the central observation, followed by two columns with the neighbouring location ID and time-stamp, a colunm containing the spatio-temporal distance between the two, and a final column containing the values of the variables in df at the neighbouring time and location.

References

Ohashi, Orlando, and Luis Torgo. "Wind speed forecasting using spatio-temporal indicators." ECAI. 2012.

See Also

get_st_neighbours


mrfoliveira/Evaluation-procedures-for-forecasting-with-spatio-temporal-data documentation built on April 11, 2021, 10:50 a.m.