Kurtosis - 0 or 3 is normal?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
blue-j
Posts: 68
Joined: 2007-06-12T14:03:18-07:00

Kurtosis - 0 or 3 is normal?

Post by blue-j »

is the kurtosis formula in use by identify using 0 or 3 as the normal distribution value?

http://itl.nist.gov/div898/handbook/eda ... eda35b.htm

thank you so much for your attention!!

J
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Kurtosis - 0 or 3 is normal?

Post by fmw42 »

It would appear to use the first formula without -3. So the answer is 0. You can test this by using a black image.

convert -size 10x10 xc:black -verbose info:

Image: xc:black

Channel statistics:
Red:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Green:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Blue:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Image statistics:
Overall:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: 0 (0)
kurtosis: 0
skewness: 0
blue-j
Posts: 68
Joined: 2007-06-12T14:03:18-07:00

Re: Kurtosis - 0 or 3 is normal?

Post by blue-j »

thanks as always, fred! the first definition has the normal distribution as 3 though, and the second one subtracts 3 to make it 0. so, i believe ImageMagick is using the second definition, yes?

J
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Kurtosis - 0 or 3 is normal?

Post by fmw42 »

blue-j wrote:thanks as always, fred! the first definition has the normal distribution as 3 though, and the second one subtracts 3 to make it 0. so, i believe ImageMagick is using the second definition, yes?

J

Sorry, a black image would not follow a gaussian or normal distribution. For a black image, the mean and std are zero. So that leaves us with 0/0 for the first one and 0/0 - 3 for the second one. I guess we need to look at the code.



In the code for GetImageChannelKurtosis() at about line 1312 of statistics.c shows:

Code: Select all

  if (standard_deviation != 0.0)
    {
      *kurtosis=sum_fourth_power-4.0*mean*sum_cubes+6.0*mean*mean*sum_squares-
        3.0*mean*mean*mean*mean;
      *kurtosis/=standard_deviation*standard_deviation*standard_deviation*
        standard_deviation;
      *kurtosis-=3.0;
      *skewness=sum_cubes-3.0*mean*sum_squares+2.0*mean*mean*mean;
      *skewness/=standard_deviation*standard_deviation*standard_deviation;
    }
Thus 3 is subtracted. So it looks like the second formula is the one.

You can review the code in the download folder for IM in the subdirectory magick.



Here is a test case - create a gaussian normal noise image and get the statistics. Here it show kurtosis at close to 0.

convert -size 100x100 xc:gray -seed 100 +noise gaussian -channel g -separate +channel -verbose info:
Image: xc:gray
Format: XC (Constant image uniform color)
Class: DirectClass
Geometry: 100x100+0+0
Units: Undefined
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: Gray
Depth: 16-bit
Channel depth:
gray: 16-bit
Channel statistics:
Gray:
min: 10693 (0.163165)
max: 51959 (0.792844)
mean: 32429.3 (0.49484)
standard deviation: 5092.56 (0.0777074)
kurtosis: 0.0108786
skewness: 0.026601
Post Reply