Author Topic: PJSR MAD functions?  (Read 4796 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
PJSR MAD functions?
« on: 2012 July 06 09:57:30 »
ImageIntegration's Scale + Zero Offset option uses a MAD function defined as 'median absolute deviation'.

Is this the 'median absolute deviation' from the 'mean' or from the 'median'?

Is there a PixelMath function implementing this? I can't find one in the documentation. If not, is there a way of implementing MAD as a more complex expression in pjsr somehow?

The Statistics process displays a 'AvgDev' value. I assume this is the 'mean absolute deviation' not 'median absolute deviation'. Is this correct? But again is it from the 'median' or the 'mean'?

Thanks,
Mike

Offline Geoff

  • PixInsight Padawan
  • ****
  • Posts: 908
Re: PJSR MAD functions?
« Reply #1 on: 2012 July 06 10:03:38 »
I would take it to mean the "median of the absolute deviation from the mean"
Geoff
Don't panic! (Douglas Adams)
Astrobin page at http://www.astrobin.com/users/Geoff/
Webpage (under construction) http://geoffsastro.smugmug.com/

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PJSR MAD functions?
« Reply #2 on: 2012 July 06 10:14:57 »
Thanks Geoff.

Here is my conclusion for Statistics AvgDev:

Running PixelMath Abs($target - median($target)) and then in Statistics look at the Mean of the result. This equals the AvgDev of the target.

So Statistics AvgDev is the 'mean absolute deviation from the median'.

So this is the reverse of your conclusion for MAD.

It is confusing that there are multiple variations of this type of function documented rather ambiguously.

Thanks,
Mike


Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: PJSR MAD functions?
« Reply #3 on: 2012 July 06 11:57:36 »
Oh no, my mistake, the documentation is clear. Clicking on the link 'median absolute deviation' in the ImageIntegration documentation for MAD brings up a Wiki page that defines MAD as 'median absolute deviation from the median'. I still don't see a PixelMath or ImageStatistics equivalent but I think I can code one up easily.
Regards,
Mike

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: PJSR MAD functions?
« Reply #4 on: 2012 July 06 17:49:06 »
AvgDev in Statistics, the avgdev function in PixelMath, and the Image.avgDev() and Math.avgDev() methods in PJSR, all of them refer to the mean absolute deviation from the median:


As for the MAD function (median absolute deviation from the median), there is no predefined method to compute it in PJSR. I'll implement it in version 1.8.0. It is indeed easy to write a JavaScript routine to calculate it.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/