Package flanagan.analysis

Examples of flanagan.analysis.Stat


        this.originalMedianSkewness = this.sod.medianSkewness();
        this.originalQuartileSkewness = this.sod.quartileSkewness();
        this.originalExcessKurtosis = this.sod.excessKurtosis();

        // Store original data sorted into ascending order
        Stat sorted = this.sod.sort();
        this.sortedOriginalData = sorted.array();
        this.originalIndices = sorted.originalIndices();

        // Standardize and store standardized data
        this.standardizedOriginalData = this.sod.standardize();

        // Calculate standardized original data statistics
View Full Code Here


        // initialize arrays and analyse original data
        if(!this.initializationDone)this.initialize();

        // Shift data to ensure all values are greater than zero
        this.lambdaTwo = 0.1*this.standardizedOriginalRange - this.standardizedOriginalMinimum;
        Stat st1 = this.sod.plus(this.lambdaTwo);
        this.shiftedStandardizedOriginalData = st1.getArray_as_double();

        // Create an instance of the BoxCoxFunction for Maximization
        BoxCoxFunction bcf = new BoxCoxFunction();
        bcf.shiftedData = this.shiftedStandardizedOriginalData;
        bcf.nData = this.nData;
        bcf.yTransform = new double[this.nData];
        bcf.gaussianOrderMedians = this.gaussianOrderMedians;

        // Create an instance of Maximization
        Maximization max = new Maximization();

        // Initial estimate of lambdaOne
        double[] start = {1.0};

        // Initial step size in maximization search
        double[] step = {0.3};

        // Tolerance for maximization search termination
        double maxzTol = 1e-9;

        // Maximiztaion of the Gaussian probabilty plot correlation coefficient varying lambdaOne
        max.nelderMead(bcf, start, step, maxzTol);

        // coeff[0] = value of lambdaOne for a maximum Gaussian probabilty plot correlation coefficient
        double[] coeff = max.getParamValues();
        double lambda1 = coeff[0];

        //maximum Gaussian probabilty plot correlation coefficient
        double sampleR1 = max.getMaximum();

        // Repeat maximization starting equidistant from the final value of lambdaOne on the opposite side from the starting estimate
        start[0] = lambda1 - (start[0] - lambda1);
        max.nelderMead(bcf, start, step, maxzTol);
        coeff = max.getParamValues();
        this.lambdaOne = coeff[0];
        this.transformedSampleR =  max.getMaximum();

        // Choose solution with the largest Gaussian probabilty plot correlation coefficient
        if(sampleR1>this.transformedSampleR){
            this.transformedSampleR = sampleR1;
            this.lambdaOne = lambda1;
        }

        // Store transformed data
        this.transformedData = new double[this.nData];
        if(this.lambdaOne==0.0){
            for(int i=0; i<this.nData; i++){
                this.transformedData[i] = Math.exp(this.shiftedStandardizedOriginalData[i]);
            }
        }
        else{
            for(int i=0; i<this.nData; i++){
                this.transformedData[i] = (Math.pow(this.shiftedStandardizedOriginalData[i], this.lambdaOne) - 1.0)/this.lambdaOne;
            }
        }

        // Standardize transformed data
        this.standardizedTransformedData =  (new Stat(this.transformedData)).standardize();

        // Calculate standardized transformed data statistics
        this.standardizedTransformedDataStatistics(this.standardizedTransformedData);

        // Obtain the intercept and gradient of the Gaussian probabilty plot
        Stat st4 = new Stat(this.standardizedTransformedData);
        st4 = st4.sort();
        double[] ordered = st4.array();
        Regression reg = new Regression(this.gaussianOrderMedians, ordered);
        reg.linear();
        coeff = reg.getBestEstimates();
        this.transformedIntercept = coeff[0];
        this.transformedGradient = coeff[1];
View Full Code Here

    }

    // Calculate transformed data statistics
    private void transformedDataStatistics(double[] data){
        // Calculate transformed data statistics
        Stat st2 = new Stat(data);
        this.transformedMinimum = st2.minimum();
        this.transformedMaximum = st2.maximum();
        this.transformedMedian = st2.median();
        this.transformedRange = this.transformedMaximum - this.transformedMinimum;
        this.transformedMean = st2.mean();
        this.transformedStandardDeviation = st2.standardDeviation();
        this.transformedVariance = st2.variance();
        this.transformedMomentSkewness = st2.momentSkewness();
        this.transformedMedianSkewness = st2.medianSkewness();
        this.transformedQuartileSkewness = st2.quartileSkewness();
        this.transformedExcessKurtosis = st2.excessKurtosis();

        // Arrange scaled transformed data into ascending order
        Stat st5 = new Stat(data);
        this.sortedScaledTransformedData = (st5.sort()).array();
    }
View Full Code Here


        // MEDIAN OF THE ELEMENTS
        // Returns median of all elements
        public double median(){
            Stat st = new Stat(this.matrix[0]);

            for(int i=1; i<this.numberOfRows; i++){
                st.concatenate(this.matrix[i]);
            }

            return st.median();
        }
View Full Code Here

        // Returns medians of the rows
        public double[] rowMedians(){
            double[] medians = new double[this.numberOfRows];
            for(int i=0; i<this.numberOfRows; i++){
                Stat st = new Stat(this.matrix[i]);
                medians[i] = st.median();
            }

            return medians;
        }
View Full Code Here

            for(int i=0; i<this.numberOfColumns; i++){
                double[] hold = new double[this.numberOfRows];
                for(int j=0; j<this.numberOfRows; j++){
                    hold[i] = this.matrix[j][i];
                }
                Stat st = new Stat(hold);
                medians[i] = st.median();
            }

            return medians;
        }
View Full Code Here


        // VARIANCE OF THE ELEMENTS
        // Returns variance of all elements
        public double variance(){
            Stat st = new Stat(this.matrix[0]);

            for(int i=1; i<this.numberOfRows; i++){
                st.concatenate(this.matrix[i]);
            }

            return st.variance();
        }
View Full Code Here

        // Returns variances of the rows
        public double[] rowVariances(){
            double[] variances = new double[this.numberOfRows];
            for(int i=0; i<this.numberOfRows; i++){
                Stat st = new Stat(this.matrix[i]);
                variances[i] = st.variance();
            }

            return variances;
        }
View Full Code Here

            for(int i=0; i<this.numberOfColumns; i++){
                double[] hold = new double[this.numberOfRows];
                for(int j=0; j<this.numberOfRows; j++){
                    hold[i] = this.matrix[j][i];
                }
                Stat st = new Stat(hold);
                variances[i] = st.variance();
            }

            return variances;
        }
View Full Code Here


        // STANDARD DEVIATION OF THE ELEMENTS
        // Returns standard deviation of all elements
        public double standardDeviation(){
            Stat st = new Stat(this.matrix[0]);

            for(int i=1; i<this.numberOfRows; i++){
                st.concatenate(this.matrix[i]);
            }

            return st.standardDeviation();
        }
View Full Code Here

TOP

Related Classes of flanagan.analysis.Stat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.