A closed-form filter for binary time series