def yule_walker(x,lag): number_of_rows = number_of_cols = lag sum_matrix = np.zeros(number_of_rows**2).reshape((number_of_rows,number_of_rows)) for i in range(0,number_of_rows): for j in range(0,number_of_cols): if(i==j): sum_matrix[i][j] = 1.0 else: sum_matrix[i][j] = stat.autocorr(x,abs(i-j)) return sum_matrix
def yule_matrix_rhs(x,lag): number_of_rows = number_of_cols = lag rhs_matrix = np.zeros(number_of_rows).reshape((number_of_rows,1)) for i in range(0,number_of_rows-1): rhs_matrix[i] = stat.autocorr(x,i+1) return rhs_matrix