Author Topic: Better method than arithmetric mean  (Read 3684 times)

Sang-drax

  • You created me, friend, you created me.
  • Jackass IV
  • Posts: 282
  • Karma: +10/-10
    • http://strandmark.com
Better method than arithmetric mean
« on: April 12, 2005, 01:38:27 PM »
Let's see if I'm able to explain this...
 
I have made a program which calculates the fractal dimension of an image. It seems to be somewhat working now. I use images of fractal with a well-known dimension to test the program.
 
The calculations can be done in many different ways (placing a grid over the image in different ways) and because of this and the inexactness of raster images I get different possible values.
 
For example the program give these values for one image:
1.1637 1.2043 1.2736 1.2481 1.3325 1.4155 1.2387 1.2955 1.3128 1.1805
 
The mean is 1.2665
 
The theoretical value is log(4)/log(3) = 1.2619
 
In this example the mean value is very good, but for some images the mean is a bad approximation of the dimension. However, many individual values are close to the theoretical value, but a few really bad values are messing things up.
 
So, how can I calculate a mean value and (sort of) ignore extreme values?
Least squares fitting? I'm sure there is an easy way...
« Last Edit: April 12, 2005, 01:55:02 PM by Sang-drax »

joshdick

  • Math Mod
  • Jackass III
  • Posts: 160
  • Karma: +10/-0
    • http://www.xanga.com/joshdick13
Better method than arithmetric mean
« Reply #1 on: April 12, 2005, 01:50:31 PM »
Links on fractal dimensions just in case you'd like to know what the heck Sangdrax is talking about :p
http://www.jracademy.com/~jtucek/math/dimen.html
http://en.wikipedia.org/wiki/Fractal_dimension
http://www.math.vt.edu/people/hoggard/FracGeomReport/node6.html#SECTION00015000000000000000

Sangdrax, I understand how you get the dimension using logarithms, but what method are you using that uses an arithmetic mean?
« Last Edit: April 12, 2005, 01:54:25 PM by joshdick »
:robot:

Sang-drax

  • You created me, friend, you created me.
  • Jackass IV
  • Posts: 282
  • Karma: +10/-10
    • http://strandmark.com
Better method than arithmetric mean
« Reply #2 on: April 12, 2005, 01:52:11 PM »
The numbers I posted are calculated from this image. Koch Curve:

Sang-drax

  • You created me, friend, you created me.
  • Jackass IV
  • Posts: 282
  • Karma: +10/-10
    • http://strandmark.com
Better method than arithmetric mean
« Reply #3 on: April 12, 2005, 01:59:37 PM »
Quote from: joshdick
Sangdrax, I understand how you get the dimension using logarithms, but what method are you using that uses an arithmetic mean?
I calculate the dimension numerically by using box-counting methods.
 
I place a grid over the image which is 4x4 pixels. Then I count the number of boxes which contain part of the fractal, N(4).
Now I make the grid twice as fine (2x2) and once again count the boxes, N(2).
 
The dimension is then
D = log(N(2)/N(4)) / log(4/2)
 
For different values than 2 and 4 I get different result, because the image doesn't have infinite resolution.

joshdick

  • Math Mod
  • Jackass III
  • Posts: 160
  • Karma: +10/-0
    • http://www.xanga.com/joshdick13
Better method than arithmetric mean
« Reply #4 on: April 12, 2005, 02:04:53 PM »
What if you make your grids larger, say 8x8 and 4x4?
:robot:

Sang-drax

  • You created me, friend, you created me.
  • Jackass IV
  • Posts: 282
  • Karma: +10/-10
    • http://strandmark.com
Better method than arithmetric mean
« Reply #5 on: April 12, 2005, 02:09:10 PM »
Generally, the values get worse for larger grids. In the image above 8x8 and 4x4 grids yield 1.3067 (which is OK though).
« Last Edit: April 12, 2005, 02:14:48 PM by Sang-drax »

Sang-drax

  • You created me, friend, you created me.
  • Jackass IV
  • Posts: 282
  • Karma: +10/-10
    • http://strandmark.com
Better method than arithmetric mean
« Reply #6 on: April 14, 2005, 11:38:05 AM »
OK, I've changed the method I'm using a little.

If you plot the intersecting squares versus the square diameter in a log-log diagram, the slope of the line is the dimension.

Clyde

  • Jackass I
  • Posts: 6
  • Karma: +10/-0
Better method than arithmetric mean
« Reply #7 on: April 15, 2005, 02:31:56 PM »
Quote

However, many individual values are close to the theoretical value, but a few really bad values are messing things up.

So, how can I calculate a mean value and (sort of) ignore extreme values?
Least squares fitting? I'm sure there is an easy way...


Can you not simply calculate the mean then go back ignore values that deviate by more than a certain amount then recalculate the mean?

Sang-drax

  • You created me, friend, you created me.
  • Jackass IV
  • Posts: 282
  • Karma: +10/-10
    • http://strandmark.com
Better method than arithmetric mean
« Reply #8 on: April 15, 2005, 04:10:38 PM »
Quote from: Clyde
Can you not simply calculate the mean then go back ignore values that deviate by more than a certain amount then recalculate the mean?
Yes, I experimented and tried that, but it felt like a hack. :dunno:
 
Now I'm doing things a little different and I don't have this problem.