forked from antoniofabio/tsDyn
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsetarTest_test.Rout.save
91 lines (85 loc) · 2.74 KB
/
setarTest_test.Rout.save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(tsDyn)
> suppressMessages(library(dplyr))
> library(purrr)
> library(tidyr)
> library(tibble)
> suppressWarnings(RNGversion("3.5.3"))
>
> data(IIPUs)
>
> ### grid ###
> grid <- crossing(include = c( "const", "trend","none", "both"),
+ lag = 1:2L,
+ thDelay = 0:1L,
+ test = c("1vs", "2vs3")) %>%
+ filter(thDelay<lag)
>
>
> ### run ###
> res <- grid %>%
+ mutate(dat = pmap(list(include, lag, thDelay, test),
+ ~setarTest(IIPUs[1:100],
+ include= ..1,
+ m = ..2,
+ thDelay = ..3,
+ test = ..4,
+ nboot = 2,
+ seed = 4323)))
>
>
> ### show F tests ###
> res %>%
+ mutate(Ftests = map(dat, ~enframe(.$Ftests))) %>%
+ select(-dat) %>%
+ unnest(Ftests)%>%
+ as.data.frame() %>%
+ head(10) %>%
+ print(digits=3)
include lag thDelay test name value
1 both 1 0 1vs 1vs2 8.22
2 both 1 0 1vs 1vs3 16.70
3 both 1 0 1vs 2vs3 7.82
4 both 1 0 2vs3 1vs2 8.22
5 both 1 0 2vs3 1vs3 16.70
6 both 1 0 2vs3 2vs3 7.82
7 both 2 0 1vs 1vs2 10.86
8 both 2 0 1vs 1vs3 26.08
9 both 2 0 1vs 2vs3 13.70
10 both 2 0 2vs3 1vs2 10.86
>
> res %>%
+ mutate(Ftests = map(dat, ~enframe(.$SSRs))) %>%
+ select(-dat) %>%
+ unnest(Ftests)%>%
+ as.data.frame() %>%
+ head(10) %>%
+ print(digits=3)
include lag thDelay test name value
1 both 1 0 1vs 1 113.9
2 both 1 0 1vs 2 105.2
3 both 1 0 1vs 3 97.5
4 both 1 0 2vs3 1 113.9
5 both 1 0 2vs3 2 105.2
6 both 1 0 2vs3 3 97.5
7 both 2 0 1vs 1 109.6
8 both 2 0 1vs 2 98.6
9 both 2 0 1vs 3 86.5
10 both 2 0 2vs3 1 109.6
>
>
> proc.time()
user system elapsed
30.625 0.220 31.026