# # 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. # #----- source('theta_to_lambda_ARMA_02.R') source('uncond_sum_of_squares_ARMA_02.R') source('numerically_evaluate_xt_ARMA_02.R') source('newton_fit_ARMA_02.R') z_t = scan("../../Data/series_c.dat",strip.white=T) w_t = diff(z_t,differences=2) theta10 = 0.1 theta20 = 0.1 res = theta_to_lambda_ARMA_02( theta10, theta20 ); lambda00 = res[1]; lambda10 = res[2]; rm(res) res0 = uncond_sum_of_squares_ARMA_02(lambda00,lambda10,w_t); a_t_0 = res0[[3]] # Evaluate the derivative to compute x_t x_t = numerically_evaluate_xt_ARMA_02(theta10,theta20,a_t_0,w_t) # Use newton iterations to get an estimate of theta: print("Newton iterations for theta1 and theta2 look like...") newton_fit_ARMA_02(w_t,theta10,theta20,T)