Search code examples
statisticsidl-programming-language

Robust higher statistical moments in IDL


I'm working with noisy data in IDL, so I've been using STDDEV and robust_sigma . There are papers on robust skewness and kurtosis, for instance [1] and [2], but are there implementations, as for standard deviation? (in IDL or maybe C?)


Solution

  • The documentation of http://idlastro.gsfc.nasa.gov/ftp/pro/robust/robust_sigma.pro states:

    ; OPTIONAL OUPTUT KEYWORD:
    ;       GOODVEC = Vector of non-trimmed indices of the input vector
    

    So one calls robust_sigma with an extra parameter that keeps track of the "good indices" in the data, those used to compute the robust_sigma, as opposed to those ignored in its computation.

      good_indices = lonarr(width)
      robo_2 = robust_sigma(data[*], GOODVEC=good_indices)
    

    Then use (only) those good indices to compute the other moments.

      robo_3 = skewness(data[good_indices])
      robo_4 = kurtosis(data[good_indices])
    

    No need for a special implementation.