Filtering and System Identification: A Least Squares Approach