setEPS()
postscript("10.eps", width = 11, height = 6)

dev.off()

Question 3.1

Read the data and plot the given quantities as a function of time. Indicate the test data in the plots. Comment on the evolution of the values over time.

plot(dat.f$series, dat.f$heating, type = "l", col = "blue", lwd = 1, lty = 1, cex = 0.8, bty = "n", 
     main = "Training and Testing Data of Heating Power Inside the Building", 
     xlab = "Series", ylab = "Heat Power Inside (W)")
points(dat.f$series[(n+1):(n+4)], dat.f$heating[(n+1):(n+4)], 
       col = "blue", lty = 1, pch = 16, cex = 0.8)
legend("topleft", inset = .02, legend = c("Training Data", "Testing Data"), col = c("blue", "blue"), 
       pch = c(NaN, 16), lty = c(1, 1), lwd = c(2, 2))
plot(dat.f$series, dat.f$tempExternal, type = "l", col = "blue", lwd = 1, lty = 1, cex = 0.8, bty = "n", 
     main = "Training and Testing Data of External Temperature", xlab = "Series", ylab = "Temperature (Celsius D)")
points(dat.f$series[(n+1):(n+8)], dat.f$tempExternal[(n+1):(n+8)], 
       col = "blue", lty = 1, pch = 16, cex = 0.8)
legend("bottomleft", inset = .02, legend = c("Training Data", "Testing Data"), col = c("blue", "blue"), 
       pch = c(NaN, 16), lty = c(1, 1), lwd = c(2, 2))
plot(dat.f$series, dat.f$iSolar, type = "l", col = "blue", lwd = 1, lty = 1, cex = 0.8, bty = "n", 
     main = "Training and Testing Data of Solar Irradiation", xlab = "Series", ylab = "Solar Irradiation (W / m2)")
points(dat.f$series[(n+1):(n+8)], dat.f$iSolar[(n+1):(n+8)], 
       col = "blue", lty = 1, pch = 16, cex = 0.8)
legend("topleft", inset = .02, legend = c("Training Data", "Testing Data"), col = c("blue", "blue"), 
       pch = c(NaN, 16), lty = c(1, 1), lwd = c(2, 2))

Question 3.2: Cross-Correlation Function of Heating and the Input

The lag k value returned by ccf(x, y) estimates the correlation between x[t+k] and y[t].

plotCCFunc(dat.f$tempExternal[1: num_obs], dat.f$heating[1: num_obs], "External Temp", "Heating")
plotCCFunc(dat.f$iSolar[1: num_obs], dat.f$heating[1: num_obs], "Solar Irradiation", "Heating")
setEPS()
postscript("5.eps", width = 11, height = 6)
plotCCFunc(dat.f$tempExternal[1: num_obs], dat.f$heating[1: num_obs], "External Temp", "Heating")
dev.off()
setEPS()
postscript("6.eps", width = 11, height = 6)
plotCCFunc(dat.f$iSolar[1: num_obs], dat.f$heating[1: num_obs], "Solar Irradiation", "Heating")
dev.off()


edxu96/MatrixTSA documentation built on Feb. 5, 2021, 11:30 p.m.