|
@@ -33,6 +33,8 @@ aggdf$cluster <- factor(aggdf$cluster)
|
33
|
33
|
str(aggdf)
|
34
|
34
|
clusters = levels(aggdf$cluster)
|
35
|
35
|
|
|
36
|
+mtempdf <- read.csv("../data/weatherharm.csv", stringsAsFactors = FALSE) %>% mutate(x = as.POSIXct(x, tz = "UTC"))
|
|
37
|
+
|
36
|
38
|
ggplot(aggdf, aes(y = kwh_tot_mean, x = cluster)) + geom_boxplot()
|
37
|
39
|
|
38
|
40
|
facall <- ggplot(aggdf, aes(x = read_time, y = kwh_tot_mean, color = cluster, fill = cluster)) +
|
|
@@ -260,7 +262,7 @@ hist(resid(cmodi), breaks = 100)
|
260
|
262
|
qqnorm(resid(cmodi))
|
261
|
263
|
|
262
|
264
|
|
263
|
|
-clust = "9"
|
|
265
|
+clust = "5"
|
264
|
266
|
|
265
|
267
|
cts <- filter(aggdf, cluster == clust)$kwh_tot_mean
|
266
|
268
|
ctsy <- ts(cts, frequency = floor(48 * 365.25))
|
|
@@ -276,3 +278,35 @@ ggplot(cldf, aes(x = x, y = y)) + geom_line(aes(y = f), color = "blue", size = 2
|
276
|
278
|
geom_point(aes(y = r), color = "darkgreen") +
|
277
|
279
|
coord_cartesian(xlim = c(as.POSIXct("2017-01-01", tz = "UTC"), as.POSIXct("2017-12-31", tz = "UTC")))
|
278
|
280
|
|
|
281
|
+cwcombdf <- left_join(cldf, mtempdf, by = "x")
|
|
282
|
+str(cwcombdf)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+# A variety of models
|
|
286
|
+plot(f.x ~ f.y, data = cwcombdf)
|
|
287
|
+plot(r.x ~ r.y, data = cwcombdf)
|
|
288
|
+plot(r.x ~ y.y, data = cwcombdf)
|
|
289
|
+plot(y.x ~ r.y, data = cwcombdf)
|
|
290
|
+plot(y.x ~ x, data = cwcombdf)
|
|
291
|
+plot(y.x ~ y.y, data = cwcombdf)
|
|
292
|
+plot(y.x ~ y.y, data = cwcombdf)
|
|
293
|
+plot(y.y ~ r.x, data = cwcombdf)
|
|
294
|
+plot(y.y ~ x, data = cwcombdf)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+summary(lm(f.x ~ f.y, data = cwcombdf))
|
|
298
|
+summary(lm(r.x ~ r.y, data = cwcombdf))
|
|
299
|
+summary(lm(r.x ~ y.y, data = cwcombdf))
|
|
300
|
+summary(lm(y.x ~ r.y, data = cwcombdf))
|
|
301
|
+summary(lm(y.x ~ x, data = cwcombdf))
|
|
302
|
+summary(lm(y.x ~ y.y, data = cwcombdf))
|
|
303
|
+summary(lm(y.x ~ y.y, data = cwcombdf))
|
|
304
|
+summary(lm(y.y ~ r.x, data = cwcombdf))
|
|
305
|
+summary(lm(y.y ~ x, data = cwcombdf))
|
|
306
|
+
|
|
307
|
+summary(lm(r.x ~ r.y * f.y, data = cwcombdf))
|
|
308
|
+imod <- lm(r.x ~ r.y * f.y, data = cwcombdf)
|
|
309
|
+plot(fitted(imod))
|
|
310
|
+plot(resid(imod))
|
|
311
|
+plot(cwcombdf$r.x)
|
|
312
|
+plot(cwcombdf$r.x ~ resid(imod))
|