est_theta1_MA1 = function(r1){ # # Estimates \theta_1 in the ARIMA(0,d,1) model: # # w_t = a_t - \theta_1 a_{t-1} # # using a very simple version of Newton's method. # # Inputs: # r1 = autocorrelation of lag 1 # # 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. # #----- # compute the two values of theta; take the theta such that -1 < theta < +1 # theta1 = -1/(2*r1) + sqrt( 1/((2*r1)^2) - 1 ) theta2 = -1/(2*r1) - sqrt( 1/((2*r1)^2) - 1 ) if( abs(theta1) < 1 ){ res = theta1 }else{ res = theta2 } res }