granger_test {movementsync}R Documentation

Granger causality tests applied to a SplicedView

Description

Granger causality tests applied to a SplicedView

Usage

granger_test(
  obj,
  var1,
  var2,
  var3 = "",
  lag = 1,
  granger_fn = ms_grangertest2,
  cond_granger_fn = ms_condgrangertest
)

Arguments

obj

SplicedView object

var1

column name of response

var2

column name of predictor

var3

column name of conditioning

lag

in seconds (rounded to nearest frame)

granger_fn

function to perform Granger test (defaults to ms_grangertest2)

cond_granger_fn

function to perform conditional Granger test (defaults to ms_condgrangertest)

Value

GrangerTime object

See Also

Other Granger Causality: autoplot.GrangerTime(), get_granger_interactions(), map_to_granger_test(), ms_condgrangertest(), ms_grangertest1(), ms_grangertest2(), plot.GrangerInteraction(), plot_influence_diagram()

Examples


r1 <- get_sample_recording()
rv_list <- get_raw_views(r1)
pv_list <- lapply(rv_list, get_processed_view)
get_data_points(pv_list$Central_Sitar)
fv_list <- lapply(pv_list, apply_filter_sgolay, data_points = "Nose", n = 41, p = 3)
jv_sub <- get_joined_view(fv_list)
splicing_df <- splice_time(jv_sub, win_size = 5, step_size = 0.5)
sv <- get_spliced_view(jv_sub, splicing_df)
granger_test(sv, "Nose_x_Central_Sitar", "Nose_x_Central_Tabla", lag = 1/25)
granger_test(sv, "Nose_x_Central_Sitar", "Nose_x_Central_Tabla", "Nose_y_Central_Tabla", lag = 1/25)

[Package movementsync version 0.1.4 Index]