Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. # Sample Data
  2. y <- c( -0.05628948, 0.01907727, 0.00000000, -0.01907727, 0.00000000, -0.01940678,
  3. 0.05724351, -0.01875946, -0.03848405, 0.05724351)
  4. x <- c(0.000000000,-0.071700531 ,-0.023863364, 0.013701646, 0.000000000, 0.085009788,
  5. -0.028666940, -0.046181130, -0.027316528, 0.006895152)
  6.  
  7. #Fit the model
  8. model <- arima(y, order=c(2,0,1),fixed = c(NA,NA,NA,NA,NA),xreg=x)
  9.  
  10. #Use the predict function with x again as the input
  11. fore <- predict(model,newxreg = x)[1]
  12.  
  13. ########################Output########################################
  14. Model -
  15. Call:
  16. arima(y, order = c(2, 0, 1), xreg = x, fixed = c(NA, NA, NA, NA, NA))
  17.  
  18. Coefficients:
  19. ar1 ar2 ma1 intercept x
  20. -0.7935 -0.5747 -0.2986 -0.0010 0.0569
  21. s.e. 0.4327 0.4399 0.6892 0.0026 0.1245
  22.  
  23. sigma^2 estimated as 0.0005055: log likelihood = 22.91, aic = -33.83
  24.  
  25. Predict -
  26.  
  27. > fore
  28. $`pred`
  29. Time Series:
  30. Start = 11
  31. End = 20
  32. Frequency = 1
  33. [1] -0.03206240 -0.03614031 -0.03341961 -0.03128313 -0.03206240 -0.02722754
  34. [7] -0.03369281 -0.03468892 -0.03361601 -0.03167025
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement