# Bayesian filter

## Introduction

The North Greenland Ice Core Project obtained a core sample of ice from drilling through the arctic ice shield. The oldest ice in the sample formed ca ~120000 years ago. Melting the ice and measuring its chemical composition gives information about past climate on earth. A time series which was obtained this way is shown in Figure 1. In this case, the relative difference of the ratio of occurrence of the two oxygen isotopes and from a reference value (in per mille) was measured,

In paleoscience, records from ice cores are used learn about past temperature on earth. Here time is given as years before present time with the year 2000 defined as present time (so years before the year 2000).

Fig. 1: Raw time series.

These measurements are distorted by noise. Scientists are interested in a quantity (the true values) which changes over time, written as . They have produced a sequence of measurements

and, as the measurement errors stem from a variety of unrelated causes, model the measurement errors ,

as independent random variables with Gaussian distribution with variance for each .

Fig. 2: Recent measurements of the timeseries.

The true mechanism under which changes in time is unknown, but the researchers state that a priori is believed to follow a normal distribution and

for , where are independent normally distributed with mean zero and variance for .

## Bayesian filter

The filtered distribution of is the conditional distribution of at time given observations up to and including . It captures what we know about if we have seen the measurement points . For a random walk model with independent observation errors as above the filtered distribution of is a normal distribution and its mean and variance can be computed recursively using the filtering equations

with $the so called Kalman gain and . The mean of the filtered distribution, , serves as estimate of the unknown location of and the standard deviation$p_t\$ can be seen as measure of uncertainty about the location.

### Simulation

Apply the filter to simulated data to illustrate how the filter works. Simulate data from the model

Can you find values of , , and so that the simulated data visually somewhat resembles Figure 2? Use the Bayesian filter to reconstruct the signal from the observations . What happens if you take values for and in the filter which do not match the true values which have been used in the simulation?

### Data analysis

Download the ice core isotope time series (see Figure 1) from https://www.dropbox.com/s/yvwgz71zgvkj7sg/icecoredata.csv .

icecoredata.csv
using DelimitedFiles

[header; data]
using Plots
plot(t, y)