-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathARIMA_Model_Diagnostic_Checks.R
51 lines (26 loc) · 1.03 KB
/
ARIMA_Model_Diagnostic_Checks.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
########################## diagnostic checks of the fitted model ##############################
## vector to store the models by their names
model.fit.ByName<- c()
for(i in 1:20){
model.fit.ByName[i]<- paste("model.fit", city.name[i], sep=".")
}
##### Ljung-Box Test ##############
for(i in 1:20){
print(city.name[i])
plot.dir<- paste(sp.LJungBoxTestPlots, city.name[i],sep="/")
pdf(paste(plot.dir,".pdf",sep=""))
par(mfrow = c(1,1))
tsdiag(eval(parse(text=model.fit.ByName[i])))
dev.off()
}
## qqNorm Plot on the residual values of the fitted model ##########
for(i in 1:20){
print(city.name[i])
plot.dir<- paste(sp.QQNormTestPlots, city.name[i],sep="/")
pdf(paste(plot.dir,".pdf",sep=""))
par(mfrow = c(1,1))
qqnorm(eval(parse(text=model.fit.ByName[i]))$residuals, asp = 1)
qqline(eval(parse(text=model.fit.ByName[i]))$residuals, asp=1)
dev.off()
}
########################## End of the diagnostic checks of the fitted model ########################