-
Notifications
You must be signed in to change notification settings - Fork 1
/
pv2_report_generator.R
146 lines (125 loc) · 4.53 KB
/
pv2_report_generator.R
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
source('funcs.R')
# benchmark models ----
report.full(model = 'snaive()',
series = 'pv2',
transformation = 'identity()',
traindays = 7,
testdays = 1)
report.full(model = 'meanf()',
series = 'pv2',
transformation = 'identity()',
traindays = 7,
testdays = 1)
report.full(model = 'naive()',
series = 'pv2',
transformation = 'identity()',
traindays = 7,
testdays = 1)
# 5:2 full ----
#simple
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS")',
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
serial = TRUE)
# fourier terms, inspiration from the 1hrs series, K=3
report.full(model = 'Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=fourier(., K=3))',
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
xreg = 'fourier(., h=h, K=3)',
serial=TRUE)
# fourier terms without SAR
# fourier terms, inspiration from 1hrs series
report.full(model = 'Arima(order=c(1, 0, 0), method="CSS", xreg=fourier(., K=3))',
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
xreg = 'fourier(., h=h, K=3)',
serial=TRUE)
# dummies, inspiration from 2hrs, including K=2
# ATTENTION: I converted from "dummies" in the `2hrs pv2 series`` to "hours", this means, I multipled by 2 to get the hourly intervals right
# with 8th hour up to 16th hour dummies - inspiration from 2hrs series
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(8*(frequency(.)/24)+1, 8*(frequency(.)/24), length(.), frequency(.)),
fourier(., h=h, K=2)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(8*(frequency(.)/24)+1, 8*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=2)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)
#dummies, inspiration from 1hrs
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(13*(frequency(.)/24)+1, 2*(frequency(.)/24), length(.), frequency(.)),
fourier(., h=h, K=3)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(13*(frequency(.)/24)+1, 2*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=3)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), seasonal=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)
#VERY FAST because I removed the SAR term for the two cases above
# 8th hour to 16th hour, K=2
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(8*(frequency(.)/24)+1, 8*(frequency(.)/24), length(.), frequency(.)),
fourier(., h=h, K=2)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(8*(frequency(.)/24)+1, 8*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=2)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)
# 13th hour to 15th hour, K=3
obsDummies.fcast <- quote(
{cbind(
dummies=getNthObsDummies(13*(frequency(.)/24)+1, 2*(frequency(.)/24), length(.), frequency(.)),
fourier(., h=h, K=3)
)}
)
obsDummies.fit <- quote(
{cbind(
dummies=getNthObsDummies(13*(frequency(.)/24)+1, 2*(frequency(.)/24), length(.), frequency(.)),
fourier(., K=3)
)}
)
report.full(model = paste0('Arima(order=c(1, 0, 0), method="CSS", xreg=', paste0(deparse(obsDummies.fit), collapse='') ,')'),
series = 'pv2',
transformation = 'identity()',
traindays = 5,
testdays = 2,
xreg = paste0(deparse(obsDummies.fcast), collapse=''),
serial = TRUE)