(Cowpartwait Ch6.5) The data in the file wave.dat are the surface height of water (mm), relative to the still water level, measured using a capacitance probe positioned at the centre of a wave tank. The continuous voltage signal from this capacitance probe was sampled every 0.1 second over a 39.6-second period. The objective is to fit a suitable ARMA(p, q) model that can be used to generate a realistic wave input to a mathematical model for an ocean-going tugboat in a computer simulation. The results of the computer simulation will be compared with tests using a physical model of the tugboat in the wave tank.
= read.csv("https://nmimoto.github.io/datasets/wave.csv", header=T)
D = ts(D, start=c(1,1), freq=1)
Wave
library(forecast)
plot(Wave)
source('https://nmimoto.github.io/R/TS-00.txt')
= auto.arima(Wave, d=0)
Fit01
Fit01Randomness.tests(Fit01$resid)
#Turn Stepwise and Approximate
= auto.arima(Wave, d=0, stepwise=FALSE, approximation=FALSE)
Fit02
Fit02Randomness.tests(Fit02$resid)
#
= Arima(Wave, order=c(2, 0, 3))
Fit12
Fit12Randomness.tests(Fit12$resid)
#
= Arima(Wave, order=c(5, 0, 6))
Fit13
Fit13Randomness.tests(Fit13$resid)
# Turn off Stepwise and Approximate and mean
= auto.arima(Wave, d=0, stepwise=FALSE, approximation=FALSE, allowmean=FALSE)
Fit03
Fit03Randomness.tests(Fit03$resid)
# Same as auto.arima above
= Arima(Wave, order=c(2,0,3), include.mean=FALSE)
Fit04
Fit04
# Increase p and q
= Arima(Wave, order=c(3,0,4), include.mean=FALSE)
Fit05
Fit05Randomness.tests(Fit05$resid)
# Increase more
= Arima(Wave, order=c(4,0,5), include.mean=FALSE)
Fit05
Fit05Randomness.tests(Fit05$resid)
# Remove MA5
= Arima(Wave, order=c(4,0,4), include.mean=FALSE)
Fit06
Fit06Randomness.tests(Fit06$resid)
# Increase p to 5
= Arima(Wave, order=c(5,0,4), include.mean=FALSE)
Fit07
Fit07Randomness.tests(Fit07$resid)
# Increase p to 6
= Arima(Wave, order=c(6,0,4), include.mean=FALSE)
Fit08
Fit08Randomness.tests(Fit08$resid)
# Increase p to 7
= Arima(Wave, order=c(7,0,4), include.mean=FALSE)
Fit09
Fit09Randomness.tests(Fit09$resid)
# Increase p to 8
= Arima(Wave, order=c(8,0,4), include.mean=FALSE)
Fit10
Fit10Randomness.tests(Fit10$resid)
# Increase q to 5
= Arima(Wave, order=c(8,0,5), include.mean=FALSE)
Fit10
Fit10Randomness.tests(Fit10$resid)
#- Simulating Waves ---
= arima.sim( n=400, list(ar=Fit01$coef[1:3], ma=Fit01$coef[4:8]),
X sd=sqrt(Fit01$sigma2) ) + Fit01$coef[9]
ts.plot(X,Wave, col=c("black","blue"), main="Actual Wave vs Simulated Wave")
Not relevant to the wave data, but it’s possible to keep ARMA(3,5) but turn off \(\theta_2\) and \(\theta_4\).
= read.csv("https://nmimoto.github.io/datasets/wave.csv")
D = ts(D, start=c(1,1), freq=1)
Wave
library(forecast)
plot(Wave)
#Fit ARMA(3,5) with theta2 and theta4 =0 (Phis, Thetas, Mean).
= Arima(Wave, order=c(3,0,5), fixed=c(NA,NA,NA, NA,0,NA,0,NA, NA ) )
Fit2 Fit2
## Series: Wave
## ARIMA(3,0,5) with non-zero mean
##
## Coefficients:
## ar1 ar2 ar3 ma1 ma2 ma3 ma4 ma5
## 1.8743 -1.395 0.3101 -1.6210 0 0.9117 0 -0.2695
## s.e. 0.0629 0.092 0.0571 0.0343 0 0.0650 0 0.0369
## mean
## -4.9952
## s.e. 0.7309
##
## sigma^2 = 19933: log likelihood = -2521.46
## AIC=5058.93 AICc=5059.3 BIC=5090.78