SHARE
TWEET

Untitled

a guest Feb 16th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. acf(yres1)
  2. pacf(yres1)
  3. ##pacf disappears suggests an AR model
  4.  
  5. #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
  6. co2=arima(yres1,order=c(4,0,2),include.mean=FALSE)
  7. co2
  8. ##check this is appropraite
  9. #First Check diagnostics/ white-noiseness of residuals
  10. tsdiag(co2)
  11. # residuals are like white noise, as the sample acf is close to zero at lag 1 - middle plot
  12. # bottom plot shows Ljung-Box statistics to lag 10 - set of p-values. These are high so residuals look like white noise.  
  13. #can run Ljung-box to different lag:
  14. x=co2$residuals
  15. p = rep(0, 10)
  16. for (i in 1:10) {
  17.   p[i] = Box.test(x, i, type = "Ljung-Box" )$p.value
  18. }
  19. p.min = .05 # level of significance
  20. plot(p, ylim=c(0,1),main="p values for Ljung-Box statistic", xlab="lag",ylab="p value")
  21. abline(h=p.min,col=4,lty=2)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top