IMA_minimization = function(w_t,deltaL=0.05){ # # Inputs: # w_t : the input time series # deltaL : the width in spacing between samples of lambda_{-1}, lambda_0, lambda_1. # smaller sampling widths take more time to perform searches for the global minimum. # # 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_03.R') # The grid we will search over: lambda1m = seq(0,1.4,by=deltaL) lambda0 = seq(0,1.4,by=deltaL) lambda1 = seq(0,1.4,by=deltaL) # The *unconditional* sum of squares function S_(lambda1m,lambda0,lambda1) # min_s_value = Inf min_lambda1m_spot = NaN min_lambda0_spot = NaN min_lambda1_spot = NaN for( lim in 1:length(lambda1m) ){ for( li0 in 1:length(lambda0) ){ for( li1 in 1:length(lambda1) ){ ss = uncond_sum_of_squares_ARMA_03(lambda1m[lim],lambda0[li0],lambda1[li1],w_t) if( ss[[1]] < min_s_value ){ #print(sprintf("NEW MIN: lambda1m = %10.6f lambda0 = %10.6f; lambda1 = %10.6f; S= %10.6f",lambda1m[lim],lambda0[li0],lambda1[li1],ss[[1]])) min_lambda1m_spot = lim min_lambda0_spot = li0 min_lambda1_spot = li1 min_s_value = ss[[1]] } } } } list( c(lambda1m[min_lambda1m_spot],lambda0[min_lambda0_spot],lambda1[min_lambda1_spot],min_s_value) ) }