# # Computes the maximum likelihood ARIMA coefficients for the yield data set. # # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- # get the data into an R vector: Y <- c( 17400, 15000, 17047, 19159, 24185, 30420 , 29866, 21575, 18865, 18487, 27407, 27410 , 25126, 18458, 20210, 21870, 14587, 17499 , 23292, 18691, 17007, 14870, 26572, 27138 , 13357, 17809, 14477, 15831, 19393, 17070 , 17874, 14883, 19013, 13886, 16468, 11019 , 10889, 16658, 14616, 16159, 17202, 12464 , 10193, 11322, 9971, 11611, 11619, 12401 , 9196, 12443, 11677, 11185, 11015, 9738 ) Y <- log(Y) # construct a ARIMA(2,1,1) model on this data ... explicitly considering the mean fit <- arima( Y, order=c(2,1,1), method="ML" ) print(fit) # drop the AR(2) components and reestimate the model: fit <- arima( Y, order=c(0,1,1), method="ML" ) # predict the next four months: predict( fit, n.ahead=4 )