Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- acf(yres1)
- pacf(yres1)
- ##pacf disappears suggests an AR model
- #fit ARMA model to data MEAN =FALSE MEANS MEAN SET TO ZERO, COEFFICIENTS SHOULD BE LARGER THAN STANDARD ERRORS TO SHOW SIGNIFICANTLY DIFFERENT THAN ZERO
- co2=arima(yres1,order=c(4,0,2),include.mean=FALSE)
- co2
- ##check this is appropraite
- #First Check diagnostics/ white-noiseness of residuals
- tsdiag(co2)
- # residuals are like white noise, as the sample acf is close to zero at lag 1 - middle plot
- # bottom plot shows Ljung-Box statistics to lag 10 - set of p-values. These are high so residuals look like white noise.
- #can run Ljung-box to different lag:
- x=co2$residuals
- p = rep(0, 10)
- for (i in 1:10) {
- p[i] = Box.test(x, i, type = "Ljung-Box" )$p.value
- }
- p.min = .05 # level of significance
- plot(p, ylim=c(0,1),main="p values for Ljung-Box statistic", xlab="lag",ylab="p value")
- abline(h=p.min,col=4,lty=2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement