Similarity between two curves

1.2k Views Asked by At

I am trying to find out how well a deterministic version of a MATLAB program predicts the stochastic version. I don't know what statistical test/quantitative analysis to use. This is what the output of the program looks like: enter image description here

1

There are 1 best solutions below

0
On

The usual way would be to look at the squared deviation: the smaller it is, the better. So you could choose some arbitrary time interval, say 0.1 sec, and divide your time line in $t=1,2,3,...$ increments. Then you sum the deviations (or approximation errors) $$Error=\sum_t [D(t)-S(t)]^2.$$ The smaller your error, the smaller are the deviations and the better is your deterministic approximation.

I am assuming that your stochastic output differs if you run it several times. So it is probably a good idea to record several $S_i(t)$ series ($i=1,2,..$ for each iteration) and check the loss over all of these to weed out the small sample noise: $$Error=\sum_i\sum_t [D(t)-S_i(t)]^2.$$ The more iterations you include the better.

If it is computationally feasible, instead of using arbitrary discrete time increments as written above, you can take numerical integrals in matlab: $$Error=\sum_i\int [D(t)-S_i(t)]^2 dt.$$ This removes arbitrariness in choosing the increment and is more precise, but computationally more expensive.

One last thing: in order to find the deterministic function that best approximates the stochastic ones under squares loss, you can just use ordinary least squares techniques. Just fit, say, a fifth degree polynomial to your data, then you are guaranteed to have the function with the smallest deviation (for a given functional form and number of parameters).