Class FracStats

java.lang.Object
  |
  +--FracStats

public class FracStats
extends java.lang.Object

Class for FracLac calculates statistics on passed arrays. Can remove areas of horizontal slope from the array, and return alternate values (see constructors). This program is free software distributed in the same way that ImageJ is. A. Karperien, Charles Sturt University, August 2003 Copyright (C) 2003 Audrey Karperien For futher information or to send comments, bugs, and feature requests contact the author or see FracLac page.

file: FracLac_2003August__1.java

IDE: Sun ONE Studio 4, Community Edition

Since:
J2SKD1.4.1_02b

Field Summary
 float[] CCount
           
 double cdf
          Compressed fractal dimension.
 double cF
          Compressed F parameter.
 int correctedNumBoxes
           
 double crsq
          R squared for Compressed regression line.
 int[] CSize
           
 double cstderr
          Standard error compressed log-log regression line.
 double cyint
          Compressed y-intercept.
 double df
          Fractal dimension or negative slope of log-log regression line
 double F
          F parameter
 double lcdf
          Linear regression line compressed slope.
 double lcF
          F parameter for linear Compressed regression line.
 double lcrsq
          R squared for linear @link #FindCompressed Compressed} regression line.
 double lcstderr
          Standard error for Compressed linear regression line.
 double lcyint
          Y-intercept for linear Compressed regression line.
 double ldf
          Slope of linear regression line.
 double lF
          F parameter for linear regression line.
 double lrsq
          R squared for linear regression line.
 double lstderr
          Standard error of linear regression line.
 double lyint
          Y-intercept of linear regression line.
 float[] oldcount
           
 int oldnum
           
 int[] oldsize
           
 double rsq
          R squared for log-log regression line.
 double stderr
          Standard error of log-log regression line.
 double yint
          Y intercept of log-log regression line.
 
Constructor Summary
FracStats(float[] C, int[] S, int originalNumSizes)
          Constructor accepts arrays and calls GetStats method.
FracStats(int[] C, int[] S, int originalNumSizes)
          Constructor accepts arrays and calls GetStats method.
 
Method Summary
 double[] FindCompressed(float[] testarray, int[] Sizes, int oldNumSizes)
          Removes areas of horizontal slope and returns array.
 double[] FindCompressed(int[] intCount, int[] intSizes, int oldNmSzs)
          Removes areas of horizontal slope and returns array for negative slope of regression line (box count fractal dimension), y intercept, and correlation coefficient from log-log plot of passed arrays.
 double[] FindDfStats(float[] Counts, int[] Sizes, int NumSizes)
          Returns array containing power law regression data, using Counts (Y) array and 1/Sizes (1/X) array.
 double[] FindDfStats(int[] Counts, int[] Sizes, int NumSizes)
          Returns a FindDfStats instance from integers arrays.
 void GetStats(float[] oldcount, int[] oldsize, int originalNumSizes)
          Gets all stats on the data.
 double[] LinearRegression(float[] Counts, int[] Sizes, int NumSizes)
          Returns the negative slope of the regression line (box count fractal dimension), the y intercept (for lacunarity), and the correlation coefficient from the passed arrays without converting to logs.
 double log(double number)
          Converts to log base 10.
 double log(float number)
          Converts to log base 10.
 double log(int number)
          Converts to log base 10.
 double[] PlainLinearRegression(float[] Y, int[] X, int Num)
           
 double[] ratioFindDfStats(float[] Counts, int[] Sizes, int NumSizes)
          Calculates stats using the log-log plot of Counts and the ratio of Sizes/Biggest Size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oldcount

public float[] oldcount

oldsize

public int[] oldsize

correctedNumBoxes

public int correctedNumBoxes

oldnum

public int oldnum

CSize

public int[] CSize

CCount

public float[] CCount

df

public double df
Fractal dimension or negative slope of log-log regression line


yint

public double yint
Y intercept of log-log regression line.


F

public double F
F parameter


cdf

public double cdf
Compressed fractal dimension.


cyint

public double cyint
Compressed y-intercept.


cF

public double cF
Compressed F parameter.


rsq

public double rsq
R squared for log-log regression line.


crsq

public double crsq
R squared for Compressed regression line.


ldf

public double ldf
Slope of linear regression line.


lyint

public double lyint
Y-intercept of linear regression line.


lrsq

public double lrsq
R squared for linear regression line.


lF

public double lF
F parameter for linear regression line.


stderr

public double stderr
Standard error of log-log regression line.


lstderr

public double lstderr
Standard error of linear regression line.


cstderr

public double cstderr
Standard error compressed log-log regression line.


lcdf

public double lcdf
Linear regression line compressed slope.


lcrsq

public double lcrsq
R squared for linear @link #FindCompressed Compressed} regression line.


lcyint

public double lcyint
Y-intercept for linear Compressed regression line.


lcF

public double lcF
F parameter for linear Compressed regression line.


lcstderr

public double lcstderr
Standard error for Compressed linear regression line.

Constructor Detail

FracStats

public FracStats(int[] C,
                 int[] S,
                 int originalNumSizes)
Constructor accepts arrays and calls GetStats method.

Parameters:
C - integer array (corresponds to counts for fractal analysis
S - integer array (corresponds to sizes for fractal analysis
originalNumSizes - number of values to use in passed arrays

FracStats

public FracStats(float[] C,
                 int[] S,
                 int originalNumSizes)
Constructor accepts arrays and calls GetStats method.

Parameters:
C - float array (corresponds to counts for fractal analysis
S - integer array (corresponds to sizes for fractal analysis
originalNumSizes - number of values to use in passed arrays
Method Detail

GetStats

public void GetStats(float[] oldcount,
                     int[] oldsize,
                     int originalNumSizes)
Gets all stats on the data. Must be called to read values properly; is automatically called by constructors but must be called again for any changes. Sets variables after calling FindDfStats, FindCompressed, and LinearRegression methods. Variables set are df, rsq, yint, F, stderr, cdf, crsq, cyint, cF, cstderr, ldf, lrsq, lyint, lF, lstderr, lcdf, lcrsq, lcyint, lcF, lcstderr.

Parameters:
oldcount - float array of counts
oldsize - integer array of sizes
originalNumSizes - integer for number of values to use

FindCompressed

public double[] FindCompressed(int[] intCount,
                               int[] intSizes,
                               int oldNmSzs)
Removes areas of horizontal slope and returns array for negative slope of regression line (box count fractal dimension), y intercept, and correlation coefficient from log-log plot of passed arrays. Calls an overloaded version of FindCompressed that accepts a float array after converting the Count array of integers to floats.

Returns:
double array with 3 entries for negative slope of regression line (box count fractal dimension), y intercept, and correlation coefficient from regression line for log-log plot of compressed arrays

FindCompressed

public double[] FindCompressed(float[] testarray,
                               int[] Sizes,
                               int oldNumSizes)
Removes areas of horizontal slope and returns array.

Parameters:
testarray - is the first float array to assess (e.g., of counts of boxes containing pixels in a box count)
Sizes - is an integer array, the second array to assess in calculating regression line
oldNumSizes - int for the number of entries to assess in the passed arrays
Returns:
double array from FindDfStats method

ratioFindDfStats

public double[] ratioFindDfStats(float[] Counts,
                                 int[] Sizes,
                                 int NumSizes)
Calculates stats using the log-log plot of Counts and the ratio of Sizes/Biggest Size. See FindDfStats for further calculations.

Parameters:
Counts - float array
Sizes - integer array
NumSizes - integer for number of values to use
Returns:
double array of statistics as the negative slope of the regressionline or fractal dimension, the rsquared for the regression line, the y-intercept, the inverse of the prefactor, and the standard error.

FindDfStats

public double[] FindDfStats(float[] Counts,
                            int[] Sizes,
                            int NumSizes)
Returns array containing power law regression data, using Counts (Y) array and 1/Sizes (1/X) array. Regression equation is calculated as usual linear regression using log of passed arrays. Df=NumSizes(SumXY) -(SumX)(SumY)/(NumSizes(SumXsquared)-SumX*SumX) and a=(SumY-Df(SumX))/NumSizes

Parameters:
Counts - array of floats
Sizes - array of integers; 1/Sizes[i] is used
NumSizes - an integer for the number of values to use from the passed arrays
Returns:
double array with array[0]=fractal dimension or slope , array[1]=r squared correlation coefficient; array[2]=y intercept for linear equation y =(Df)*x + b; array[3]=1/F, where F=euler's number ^y intercept, array[4]=standard error

log

public double log(double number)
Converts to log base 10.

Parameters:
number - double to convert
Returns:
double log base 10 of number

log

public double log(int number)
Converts to log base 10.

Parameters:
number - int to convert
Returns:
double log base 10 of number

log

public double log(float number)
Converts to log base 10.

Parameters:
number - float to convert
Returns:
double log base 10 of number

LinearRegression

public double[] LinearRegression(float[] Counts,
                                 int[] Sizes,
                                 int NumSizes)
Returns the negative slope of the regression line (box count fractal dimension), the y intercept (for lacunarity), and the correlation coefficient from the passed arrays without converting to logs. Operates on the inverse of the sizes array.

Parameters:
Counts - float array (e.g., number of boxes that contained pixels when an image was scanned using many series of box sizes, where one box size is applied over the whole image without overlap and the number that contained pixels is recorded for each scan)
Sizes - float array (e.g., the corresponding array of box sizes
NumSizes - integer for the number of elements to use in both arrays
Returns:
double array with 5 entries: negative slope of the regression line, r squared correlation coefficient, y intercept, inverse of prefactor, and standard error

PlainLinearRegression

public double[] PlainLinearRegression(float[] Y,
                                      int[] X,
                                      int Num)

FindDfStats

public double[] FindDfStats(int[] Counts,
                            int[] Sizes,
                            int NumSizes)
Returns a FindDfStats instance from integers arrays. Calls FindDfStats for floats after converting passed Counts array to floats.

Parameters:
Counts - integer array
Sizes - integer array
NumSizes - integer for number of values to use
Returns:
double array of values based on passed arrays