# Kalman Filter to correct model simulation bias

I am working with a large scale deterministic model, which attempts to simulate CO2 emissions in different regions. When compared to historic data, the model output suffers from systematic biases. Here are plots for two regions (model output in blue, historic data in red) :  I am searching for a method to estimate the systematic bias in the model output and correct the forecasts of the model. In my view, the (scalar) Kalman Filter is an appropriate choice:

$x_t = A x_{t-1} + B u_t + w_t$

$z_t = H x_t + v_t$

where $w_t$ and $v_t$ are gaussian white noise. The first equation represents the state equation, which is assumed to be unknown. The second one is the measurement equation.

Here are my questions:

1. Can the kalman filter be applied to this kind of bias correction? If so, I am not sure about the interpretation of the two equations: Can I say, the historic time series is the state equation and the simulation is the observed measurement $z_t$? How is the bias estimated then?

2. I am searching for an implementation of this bias correction (preferable in R or MATLAB, pseudo code would be also very nice). Important is, that no special package is used (to my knowledge, one can implement the scalar Kalman Filter with a for loop).

Thank you in advance!

Here are the data for the second plot:

time    historic    model
1   0   0
2   0   0
3   0   0.323
4   0   0.323
5   0   0.323
6   0   0.299
7   0   0.299
8   0   0.299
9   0   0.303
10  0   0.299
11  0   0.252
12  0   0.372
13  0   0.298
14  0   0.292
15  0   0.398
16  0   0.432
17  0   0.435
18  0   0.424
19  0   0.407
20  0   0.404
21  0   0.406
22  0   0.378
23  0   0.327
24  0   0.353
25  0.239   0.375
26  0   0.356
27  0.229   0.408
28  0.28    0.394
29  0.251   0.409
30  0.268   0.411
31  0.281   0.41
32  0.264   0.401
33  0.286   0.402
34  0.257   0.412
35  0.284   0.4
36  0.276   0.417
37  0.273   0.367
38  0.28    0.39
39  0.278   0.431
40  0.305   0.437
41  0.334   0.445
42  0.309   0.461
43  0.306   0.458
44  0.289   0.458
45  0.288   0.454
46  0.264   0.427
47  0.283   0.473
48  0.28    0.459
49  0.308   0.426
50  0.393   0.432
51  0.326   0.418
52  0.292   0.406
53  0.257   0.412
54  0.232   0.409

• No one was answering. Is the qeustion not clear? Please give me some feedback – Daniel Ryback Sep 4 '14 at 12:55
• Do I get it right you are trying to fix the output instead of the underlying model? – James Sep 4 '14 at 19:29
• Yes, you are completely right. The approach to fix the output instead of the model is - for example - frequently applied by meteorologists and climate scientists. The point is that these models have a complex structure and involve hundred of equations. You can improve the model by calibration but at some point of time, it is more efficient to fix the model output instead. – Daniel Ryback Sep 4 '14 at 21:42
• Hi have you found a fix for this? I am happy to help but you may have found an answer at this point. Kalman Filter is definitely applicable to your data... – MoonKnight Jan 16 '15 at 10:42
• Kalman filter requires the noise to be Gaussian with zero mean and some variance which means there is no bias. I hope this helps. – CroCo Jan 22 '15 at 2:32