# # This code computes the S(lambda_0,lambda_1) for samples of lambda_0 and lambda_1 in an IMA(0,2,2) process # and returns the value of lambda_0 and lambda_1 that result in the smallest value. # # It would be nice to have this surface plotted as a three dimensional surface. One should probably # do this search over a very coarse grid first and then refine the grid as needed for higher resolution. # # 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_02.R') lambda0 = seq(0.3,1.5,by=0.01) lambda1 = seq(0,1.4,by=0.01) z_t = scan("../../Data/series_b.dat",strip.white=T) w_t = diff(z_t,differences=2) # The *unconditional* sum of squares function S_(lambda0,lambda1) # min_s_value = Inf min_lambda0_spot = NaN min_lambda1_spot = NaN for( li0 in 1:length(lambda0) ){ for( li1 in 1:length(lambda1) ){ ss = uncond_sum_of_squares_ARMA_02(lambda0[li0],lambda1[li1],w_t) if( ss[[1]] < min_s_value ){ #print(sprintf("NEW MIN: lambda0 = %10.6f; lambda1 = %10.6f; S= %10.6f",lambda0[li0],lambda1[li1],ss[[1]])) min_lambda0_spot = li0 min_lambda1_spot = li1 min_s_value = ss[[1]] } } } print(sprintf("GLOBAL MIN: lambda0 = %10.6f; lambda1 = %10.6f; S= %10.6f",lambda0[min_lambda0_spot],lambda1[min_lambda1_spot],min_s_value))