Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Sample Data
- y <- c( -0.05628948, 0.01907727, 0.00000000, -0.01907727, 0.00000000, -0.01940678,
- 0.05724351, -0.01875946, -0.03848405, 0.05724351)
- x <- c(0.000000000,-0.071700531 ,-0.023863364, 0.013701646, 0.000000000, 0.085009788,
- -0.028666940, -0.046181130, -0.027316528, 0.006895152)
- #Fit the model
- model <- arima(y, order=c(2,0,1),fixed = c(NA,NA,NA,NA,NA),xreg=x)
- #Use the predict function with x again as the input
- fore <- predict(model,newxreg = x)[1]
- ########################Output########################################
- Model -
- Call:
- arima(y, order = c(2, 0, 1), xreg = x, fixed = c(NA, NA, NA, NA, NA))
- Coefficients:
- ar1 ar2 ma1 intercept x
- -0.7935 -0.5747 -0.2986 -0.0010 0.0569
- s.e. 0.4327 0.4399 0.6892 0.0026 0.1245
- sigma^2 estimated as 0.0005055: log likelihood = 22.91, aic = -33.83
- Predict -
- > fore
- $`pred`
- Time Series:
- Start = 11
- End = 20
- Frequency = 1
- [1] -0.03206240 -0.03614031 -0.03341961 -0.03128313 -0.03206240 -0.02722754
- [7] -0.03369281 -0.03468892 -0.03361601 -0.03167025
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement