# # 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('uncond_sum_of_squares_ARMA_01.R') source('numerically_evaluate_xt_ARMA_01.R') source('newton_fit_ARMA_01.R') z_t = scan("../../Data/series_a.dat",strip.white=T) w_t = diff(z_t) theta10 = 0.5 # Compute [a_t] under this initial value of theta: res0 = uncond_sum_of_squares_ARMA_01(theta10,w_t) a_t_0 = res0[[3]] # Compute the (negative) derivative or x_t for this value of theta: x_t = numerically_evaluate_xt_ARMA_01(theta10,a_t_0,w_t) print("The negative derivative or x_t is given by...") print(x_t[10:30]) # Use newton iterations to get an estimate of theta: print("Newton iterations (and final estimates) look like...") newton_fit_ARMA_01(w_t,0.5,T)