title: Hampel Matlab vs R
body: <p>I am trying to rewrite code from Matlab in R and I am failing at the Hampel-Filter which seems to be distinct.</p>
  <pre><code>absmeasuredAccelerations&lt;-(9.817899,9.923724,9.915009,9.414430,9.912013,9.822199,9.662423,9.809928,9.812976,9.883809)
  </code></pre>
  <ol>
  <li>The vector I am applying the Hampel-Filter in Matlab and R is identical as seen below.</li>
  </ol>
  <p><a href="https://i.stack.imgur.com/KIPqE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KIPqE.png" alt="enter image description here" /></a></p>
  <p>Matlab Source:</p>
  <pre><code>Filtered = hampel(absmeasuredAccelerations,30,0.05);
  </code></pre>
  <p>In R:</p>
  <pre><code>Filtered&lt;- hampel(absmeasuredAccelerations, k=15,t0=0.05)$y
  </code></pre>
  <p>Comparing the output between Matlab and R, there is a significant distinction as seen below:</p>
  <p><a href="https://i.stack.imgur.com/OgXf5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OgXf5.png" alt="enter image description here" /></a></p>
  <p>Assuming the implementation of both filters is distinct, however, somehow it must be possible to reproduce results? Anyone has some ideas or what am I doing wrong?</p>