sample_wts: Get spatio-temporal re-sampling weights

Description Usage Arguments Details Value See Also

View source: R/sampling_weight.R

Description

A function that calculates different weights for re-sampling that is temporally and/or spatially biased.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
sample_wts(
  form,
  df,
  phi.control,
  site_id,
  time,
  rel.thr,
  ptype,
  alpha,
  sites_sf = NULL,
  lon = NULL,
  lat = NULL,
  crs = NULL
)

Arguments

form

a formula describing the learning task

df

a data frame

phi.control

list of parameters as returned by function UBL::phi.control

site_id

the name of the column containing location IDs

time

the column name of the time-stamp

rel.thr

a relevance threshold above which an observation is considered relevant

ptype

type of spatio-temporal bias to calculate

alpha

weighting parameter for temporal and spatial re-sampling probabilities. Default 0.5

sites_sf

An sf obejct containing station and IDs and geometry points of the locations. As an alternative, provide lon, lat, and crs

lon

the name of the column containing the location's longitude

lat

the name of the column containing the location's latitude

crs

the code for the Coordinate Reference System

Details

phi gives the target variable's relevance (higher relevance: phi -> 1; lower relevance: phi -> 0); time_wts gives the observation's temporally biased re-sampling weight (most recent observations: w -> 1; oldest: w -> 0.); space_wts gives the observation's spatially biased re-sampling weight (farthest away from other relevant cases at time slice: d -> 1.). High time_wts or space_wts means the observation is more likely to be kept.

Value

a data.frame with relevance phi, temporally biased weights time_wts, and spatially biased weights space_wts for each row in df.

See Also

get_phi, get_time_wts, get_phi_space_wts.


mrfoliveira/STResampling-JDSA2020 documentation built on June 28, 2021, 7:01 p.m.