Skip to contents

F-test of the x-lag block in an AR model for y. Mirrors morie.fn.ggrcst.

Usage

morie_granger_test(x, y, p = 1L)

Arguments

x

Candidate cause series.

y

Response series.

p

Lag order.

Value

List with statistic, p_value, df, n.

References

Granger CWJ (1969). Econometrica 37(3), 424-438.

Examples

# x drives y one step later; a term no lag explains keeps the fit inexact
x <- sin(1:60)
y <- c(0, 0.8 * x[-60]) + 0.3 * cos(3 * (1:60))
morie_granger_test(x, y)
#> $statistic
#> [1] 468.7189
#> 
#> $p_value
#> [1] 6.931716e-29
#> 
#> $df
#> [1]  1 56
#> 
#> $n
#> [1] 60
#>