Package flanagan.io

Examples of flanagan.io.FileOutput


        this.transformedProbabilityPlot();

        int posdot = title.indexOf(".");
        if(posdot==-1)title = title + ".txt";

        FileOutput fout = new FileOutput(title);
        fout.println("Box-Cox Analysis");
        fout.println("File name:   " + title);
        Date d = new Date();
        String day = DateFormat.getDateInstance().format(d);
        String tim = DateFormat.getTimeInstance().format(d);
        fout.println("Program executed at " + tim + " on " + day);
        fout.println();

        int field1 = 30;
        int field2 = 15;
        fout.print("Box-Cox lambda one", field1);
        fout.println(Fmath.truncate(this.lambdaOne, 4));
        fout.print("Box-Cox lambda two", field1);
        fout.println(Fmath.truncate(this.lambdaTwo, 4));
        fout.println();

        fout.print("  ", field1);
        fout.print("Transformed", field2);
        fout.print("  ", field2);
        fout.println("Original   ");
        fout.print("  ", field1);
        fout.print("scaled data", field2);
        fout.print("  ", field2);
        fout.println("data   ");
        fout.println();

        fout.print("                            ", field1);
        fout.print("Value", field2);
        fout.print("Error", field2);
        fout.print("Value", field2);
        fout.println("Error");
        fout.println();

        fout.println("Gaussian Probability plot ");
        fout.print("  Correlation coefficient", field1);
        fout.print(Fmath.truncate(this.transformedSampleR, 4), field2);
        fout.print(" ", field2);
        fout.println(Fmath.truncate(this.originalSampleR, 4));

        fout.print("  Gradient", field1);
        fout.print(Fmath.truncate(this.transformedGradient, 4), field2);
        fout.print(Fmath.truncate(this.transformedGradientError, 4), field2);
        fout.print(Fmath.truncate(this.originalGradient, 4), field2);
        fout.println(Fmath.truncate(this.originalGradientError, 4));

        fout.print("  Intercept", field1);
        fout.print(Fmath.truncate(this.transformedIntercept, 4), field2);
        fout.print(Fmath.truncate(this.transformedInterceptError, 4), field2);
        fout.print(Fmath.truncate(this.originalIntercept, 4), field2);
        fout.println(Fmath.truncate(this.originalInterceptError, 4));
        fout.println();

        fout.print("Data ");
        fout.println();
        fout.print("  Mean", field1);
        fout.print(Fmath.truncate(this.transformedMean, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMean, 4));

        fout.print("  Median", field1);
        fout.print(Fmath.truncate(this.transformedMedian, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMedian, 4));

        fout.print("  Standard deviation", field1);
        fout.print(Fmath.truncate(this.transformedStandardDeviation, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalStandardDeviation, 4));

        fout.print("  Standard error", field1);
        fout.print(Fmath.truncate(this.transformedStandardDeviation/Math.sqrt(this.nData), 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalStandardDeviation/Math.sqrt(this.nData), 4));

        fout.print("  Moment skewness", field1);
        fout.print(Fmath.truncate(this.transformedMomentSkewness, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMomentSkewness, 4));

        fout.print("  Median skewness", field1);
        fout.print(Fmath.truncate(this.transformedMedianSkewness, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMedianSkewness, 4));

        fout.print("  Quartile skewness", field1);
        fout.print(Fmath.truncate(this.transformedQuartileSkewness, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalQuartileSkewness, 4));

        fout.print("  Excess kurtosis", field1);
        fout.print(Fmath.truncate(this.transformedExcessKurtosis, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalExcessKurtosis, 4));

        fout.print("  Minimum", field1);
        fout.print(Fmath.truncate(this.transformedMinimum, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMinimum, 4));

        fout.print("  Maximum", field1);
        fout.print(Fmath.truncate(this.transformedMaximum, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMaximum, 4));

        fout.print("  Range", field1);
        fout.print(Fmath.truncate(this.transformedRange, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalRange, 4));

        fout.close();
    }
View Full Code Here


            default: throw new IllegalArgumentException("Method number " + index + " not recognised");
        }

        // Output results to a temporary file
        FileOutput fout = null;
        String tempFileName = "ImmunoAssayTemp.txt";
        if(catFlag){
            fout = new FileOutput(tempFileName, 'a');
        }
        else{
            fout = new FileOutput(tempFileName);
        }
        this.commonPrint(fout);
        fout.println();
        fout.println();
        fout.close();

        // Return data to compare method
        al.add(new Double(super.chiSquare));
        al.add(new Integer(super.nParam));
        al.add(methodName);
View Full Code Here

        }
        if(printFlag){
            int pos = filename.indexOf(".");
            if(pos==-1)filename = filename + ".txt";
            this.filename = filename;
            FileOutput fout = new FileOutput(filename);
            fout.println(this.titleZero);
            if(this.dataRead)fout.println("Data input file name:   " + dataFilename);
            fout.dateAndTimeln(filename);

            this.commonPrint(fout);

            fout.println();
            fout.println("End of file");
            fout.close();
        }
    }
View Full Code Here

        }

        // Print the analysis to a text file
        int pos = filename.indexOf(".");
        if(pos==-1)filename = filename + ".txt";
        FileOutput fout = new FileOutput(filename);
        fout.println(this.titleZero);
        fout.println("Comparison of two fitting procedures");
        if(this.dataRead)fout.println("Data input file name " + dataFilename);
        fout.dateAndTimeln(filename);
        fout.println();
        fout.println("Equations compared:");
        fout.println("   Equation One: " + methodNameComp[0]);
        fout.println("   Equation Two: " + methodNameComp[1]);
        fout.println();

        fout.print("                    ", super.field);
        fout.print("Eqation", super.field);
        fout.println("Eqation");

        fout.print("                    ", super.field);
        fout.print("One", super.field);
        fout.println("Two");

        fout.print("Sum of squares      ", super.field);
        fout.print(Fmath.truncate(sumOfSquaresComp[0], super.prec), super.field);
        fout.println(Fmath.truncate(sumOfSquaresComp[1], super.prec));

        fout.print("Degrees of freedom  ", super.field);
        fout.print((this.nAnalyteConcns-nParamComp[0]), super.field);
        fout.println((this.nAnalyteConcns-nParamComp[1]));

        fout.println();

        switch(resultFlag){
            case 0: fout.printtab("Extra sum of squares F-ratio =                 ");
                    fout.println(Fmath.truncate(fRatio, super.prec));
                    fout.printtab("F-ratio probabilty =                           ");
                    fout.println(Fmath.truncate(fProb, super.prec));
                    fout.printtab("F value at the " + significance + " significance level = ");
                    fout.println(Fmath.truncate(fRatioAtSignificanceLevel, super.prec));
                    fout.println();
                    if(fProb<=significance){
                        fout.println("In terms of a best fit Equation Two is the preferred fit.");
                        if(Math.abs(nParamComp[1]-nParamComp[0])==1){
                            fout.println("The additional parameter has, given a " + significance + " significance level, significantly improved the fit.");
                        }
                        else{
                            fout.println("The additional parameters have, given a " + significance + " significance level, significantly improved the fit.");
                        }
                    }
                    else{
                        fout.println("In terms of a best fit Equation One is the preferred fit");
                        if(Math.abs(nParamComp[1]-nParamComp[0])==1){
                            fout.println("The additional parameter has not, given a " + significance + " significance level, significantly improved the fit.");
                        }
                        else{
                            fout.println("The additional parameters have not, given a " + significance + " significance level, significantly improved the fit.");
                        }
                    }
                   break;
            case 1: fout.println("The fittings to the two equations cannot be distinguished using an F-test analysis");
                    break;
            case 2: fout.printtab("Variance F-ratio =                            ");
                    fout.println(Fmath.truncate(fRatio, super.prec));
                    fout.printtab("F-ratio probabilty =                          ");
                    fout.println(Fmath.truncate(fProb, super.prec));
                    fout.printtab("F value at the " + significance + " significance level = ");
                    fout.println(Fmath.truncate(fRatioAtSignificanceLevel, super.prec));
                    fout.println();
                    if(fProb<=significance){
                        fout.println("In terms of a best fit Equation Two is the preferred fit");
                        fout.println("as indicated by the F-ratio analysis and a given significance level of " + significance);
                    }
                    else{
                        fout.println("The fittings to the two equations cannot be distinguished using an F-test analysis");
                    }
                    break;
        }
        fout.println("However, the choice of the model to be used as a standard curve should include, along with this comparison,");
        fout.println("observation of the displayed graphs and of the detailed analyses listed below");


        fout.println();
        fout.println();
        fout.println("Details of the two compared fitting exercises");
        fout.println();
        FileInput fin = new FileInput("ImmunoAssayTemp.txt");
        int n = fin.numberOfLines();
        String line = null;
        for(int i=0; i<n; i++){
            line = fin.readLine();
            fout.println(line);
        }
        fin.close();
        fout.println();
        fout.println("End of file");
        fout.close();

        // Delete the temporary file
        this.deleteFile("ImmunoAssayTemp.txt");
    }
View Full Code Here

        }

        // Print the polynomial to a text file with title
        public void printToText(String title){
                title = title + ".txt";
                FileOutput fout = new FileOutput(title, 'n');

                fout.println("Output File for a ComplexPoly");
                fout.dateAndTimeln();
                fout.println();
                fout.print("Polynomial degree is ");
                fout.println(this.deg);
                fout.println();
                fout.println("The coefficients are ");

                for(int i=0;i<=this.deg;i++){
                        fout.println(this.coeff[i]);
                }
                fout.println();
                fout.println("End of file.");
                fout.close();
        }
View Full Code Here

    }


    private void analysisText(){

        FileOutput fout = null;
        if(this.fileNumberingSet){
            fout = new FileOutput(this.outputFilename, 'n');
        }
        else{
            fout = new FileOutput(this.outputFilename);
        }

        // calculate alphas if not already calculated
        if(!rawAlphaCalculated)this.rawAlpha();
        if(!standardizedAlphaCalculated)this.standardizedAlpha();

        // output title information
        fout.println("CRONBACH'S ALPHA RELIABILITY ESTIMATOR");
        fout.println("Program: Cronbach - Analysis Output");
        for(int i=0; i<this.titleLines; i++)fout.println(title[i]);
        Date d = new Date();
        String day = DateFormat.getDateInstance().format(d);
        String tim = DateFormat.getTimeInstance().format(d);
        fout.println("Program executed at " + tim + " on " + day);
        fout.println();

        // output reliability estimators
        int field = 36;     // field width
        fout.println("RELIABILITY ESTIMATORS");
        fout.println("Cronbach's coefficient alpha");
        fout.print("Raw data ", field);
        fout.println(Fmath.truncate(this.rawAlpha, this.trunc));
        fout.print("Standardized data ", field);
        fout.println(Fmath.truncate(this.standardizedAlpha, this.trunc));
        fout.println();

        fout.println("Average of the inter-item correlation coefficients, excluding item totals");
        fout.print("Raw data ", field);
        fout.println(Fmath.truncate(this.rawMeanRhoWithoutTotals, this.trunc));
        fout.print("Standardized data ", field);
        fout.println(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, this.trunc));
        fout.println();

        fout.println("Average of the inter-item correlation coefficients, including item totals");
        fout.print("Raw data ", field);
        fout.println(Fmath.truncate(this.rawMeanRhoWithTotals, this.trunc));
        fout.print("Standardized data ", field);
        fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, this.trunc));
        fout.println();

        // output any deletions or replacements
        fout.println("'NO RESPONSE' DELETIONS AND REPLACEMENTS");
        // deleted persons
        field = 34;
        int fieldInt = 6;
        boolean deletionFlag = false;
        if(this.nDeletedPersons!=0){
            deletionFlag = true;
            fout.print("Number of persons deleted ", field);
            fout.println(this.nDeletedPersons);
            fout.print("Indices of deleted persons: ", field);
            for(int i=0; i<this.nDeletedPersons; i++)fout.print((this.deletedPersonsIndices[i]+1), fieldInt);
            fout.println();
        }
        else{
            fout.println("No persons were deleted ");
        }

        // deleted items
        if(this.nDeletedItems!=0){
            deletionFlag = true;
            fout.print("Number of items deleted ", field);
            fout.println(this.nDeletedItems);
            fout.print("Names of deleted items: ", field);
            for(int i=0; i<this.nDeletedItems; i++)fout.print(this.originalItemNames[this.deletedItemsIndices[i]], fieldInt);
            fout.println();
        }
        else{
            fout.println("No items were deleted ");
        }

        // replacements
        if(this.nReplacements!=0){
            fout.printtab("Number of 'no responses' replaced ");
            fout.println(this.nReplacements);
            fout.print("Item name and person index of replacements: ", 50);
            for(int i=0; i<this.nReplacements; i++)fout.print((this.replacementIndices[i]+" "), fieldInt);
            fout.println();
            fout.print("Replacement option: ", field);
            fout.println(this.replacementOptionNames[this.replacementOption-1]);
            fout.println();
        }
        else{
            if(deletionFlag){
                fout.println("No 'no response' replacements, other than any above deletions, were made ");
            }
            else{
                fout.println("No 'no response' replacements were made ");
            }
        }
        fout.println();
        fout.print("Number of items used", 35);
        fout.println(this.nItems);
        fout.print("Number of persons used", 35);
        fout.println(this.nPersons);
        fout.println();

        // Correlation coefficients
        int len = this.trunc+8;
        int fieldItemName = 0;
        for(int i=0; i<=this.nItems; i++)if(this.itemNames[i].length()>fieldItemName)fieldItemName = this.itemNames[i].length();
        int fieldItemNumber = fieldItemName;
        if(len>fieldItemNumber)fieldItemNumber = len;
        fieldItemName++;
        fieldItemNumber++;

        fout.println("CORRELATION COEFFICIENTS");
        fout.println("Correlation coefficients between items  -  raw data");
        fout.print("    ", fieldItemName);

        for(int i=0; i<=this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
        fout.println();
        for(int i=0; i<=this.nItems; i++){
            fout.print(this.itemNames[i], fieldItemName);
            for(int j=0; j<=this.nItems; j++)fout.print(Fmath.truncate(this.rawCorrelationCoefficients[i][j], this.trunc), fieldItemNumber);
            fout.println();
        }
        fout.println();

        fout.print("Average inter-item correlation coefficient (excluding total) ", 80);
        fout.println(Fmath.truncate(this.rawMeanRhoWithoutTotals, this.trunc));
        fout.print("Standard deviation of the inter-item correlation coefficient (excluding total) ", 80);
        fout.println(Fmath.truncate(this.rawStandardDeviationRhoWithoutTotals, this.trunc));
        fout.print("Average inter-item correlation coefficient (including total) ", 80);
        fout.println(Fmath.truncate(this.rawMeanRhoWithTotals, this.trunc));
        fout.print("Standard deviation of the inter-item correlation coefficient (including total) ", 80);
        fout.println(Fmath.truncate(this.rawStandardDeviationRhoWithTotals, this.trunc));

        fout.println();


        fout.println("Correlation coefficients between items  -  standardized data");
        fout.print("    ", fieldItemName);
        for(int i=0; i<=this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
        fout.println();
        for(int i=0; i<=this.nItems; i++){
            fout.print(this.itemNames[i], fieldItemName);
            for(int j=0; j<=this.nItems; j++)fout.print(Fmath.truncate(this.standardizedCorrelationCoefficients[i][j], this.trunc), fieldItemNumber);
            fout.println();
        }
        fout.println();

        fout.print("Average inter-item correlation coefficient (excluding total) ", 80);
        fout.println(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, this.trunc));
        fout.print("Standard deviation of the inter-item correlation coefficient (excluding total) ", 80);
        fout.println(Fmath.truncate(this.standardizedStandardDeviationRhoWithoutTotals, this.trunc));
        fout.print("Average inter-item correlation coefficient (including total) ", 80);
        fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, this.trunc));
        fout.print("Standard deviation of the inter-item correlation coefficient (including total) ", 80);
        fout.println(Fmath.truncate(this.standardizedStandardDeviationRhoWithTotals, this.trunc));
        fout.println();

        // item statistics
        if(fieldItemNumber<12)fieldItemNumber = 12;

        fout.println("ITEMS: MEANS, STANDARD DEVIATIONS, SKEWNESS AND KURTOSIS");
        fout.println("Raw data");
        fout.print("item ", fieldItemName);
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("moment", fieldItemNumber);
        fout.print("median", fieldItemNumber);
        fout.print("quartile", fieldItemNumber);
        fout.print("kurtosis", fieldItemNumber);
        fout.println("dichotomous");

        fout.print("    ", fieldItemName);
        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("skewness", fieldItemNumber);
        fout.print("skewness", fieldItemNumber);
        fout.print("skewness", fieldItemNumber);
        fout.print("excess  ", fieldItemNumber);
        fout.println("percentage");

        for(int i=0; i<this.nItems; i++){
            fout.print(this.itemNames[i], fieldItemName);
            fout.print(Fmath.truncate(this.rawItemMeans[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemStandardDeviations[i], this.trunc), fieldItemNumber);
           fout.print(Fmath.truncate(this.rawItemMomentSkewness[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemMedianSkewness[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemQuartileSkewness[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemKurtosisExcess[i], this.trunc), fieldItemNumber);
            fout.println(Fmath.truncate(this.dichotomousPercentage[i], 1));
        }
        fout.println();

      fout.println("ITEMS: MINIMA, MAXIMA, MEDIANS, RANGES AND TOTALS");
        fout.println("Raw data");
        fout.print("item ", fieldItemName);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.print("median", fieldItemNumber);
        fout.print("range", fieldItemNumber);
        fout.print("total", fieldItemNumber);
        fout.println("dichotomous");

        fout.print("    ", fieldItemName);
        fout.print("    ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("percentage");

        for(int i=0; i<this.nItems; i++){
            fout.print(this.itemNames[i], fieldItemName);
            fout.print(Fmath.truncate(this.rawItemMinima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemMaxima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemMedians[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemRanges[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawItemTotals[i], this.trunc), fieldItemNumber);
            fout.println(Fmath.truncate(this.dichotomousPercentage[i], 1));
        }
        fout.println();

        int fieldItemSName = 25;
        fout.print("item", fieldItemSName);
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("variance", fieldItemNumber);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.println("range");
        fout.print("statistic    ", fieldItemSName);
        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("     ");

        fout.print("item means", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemMeansMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMeansSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMeansVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMeansMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMeansMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemMeansRange, this.trunc));

        fout.print("item standard deviations", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemStandardDeviationsMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemStandardDeviationsSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemStandardDeviationsVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemStandardDeviationsMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemStandardDeviationsMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemStandardDeviationsRange, this.trunc));

        fout.print("item variances", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemVariancesMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemVariancesSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemVariancesVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemVariancesMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemVariancesMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemVariancesRange, this.trunc));

        fout.print("item mimima", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemMinimaMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMinimaSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMinimaVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMinimaMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMinimaMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemMinimaRange, this.trunc));

        fout.print("item maxima", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemMaximaMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMaximaSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMaximaVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMaximaMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMaximaMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemMaximaRange, this.trunc));

        fout.print("item medians", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemMediansMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMediansSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMediansVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMediansMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemMediansMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemMediansRange, this.trunc));

        fout.print("item ranges", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemRangesMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemRangesSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemRangesVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemRangesMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemRangesMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemRangesRange, this.trunc));

        fout.print("item totals", fieldItemSName);
        fout.print(Fmath.truncate(this.rawItemTotalsMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemTotalsSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemTotalsVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemTotalsMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawItemTotalsMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawItemTotalsRange, this.trunc));

        fout.println();

        fout.println("standardized data");
                fout.print("item ", fieldItemName);
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("moment", fieldItemNumber);
        fout.print("median", fieldItemNumber);
        fout.print("quartile", fieldItemNumber);
        fout.println("kurtosis");

        fout.print("    ", fieldItemName);
        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("skewness", fieldItemNumber);
        fout.print("skewness", fieldItemNumber);
        fout.print("skewness", fieldItemNumber);
        fout.println("excess  ");

        for(int i=0; i<this.nItems; i++){
            fout.print(this.itemNames[i], fieldItemName);
            fout.print(Fmath.truncate(this.standardizedItemMeans[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedItemStandardDeviations[i], this.trunc), fieldItemNumber);
           fout.print(Fmath.truncate(this.standardizedItemMomentSkewness[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedItemMedianSkewness[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedItemQuartileSkewness[i], this.trunc), fieldItemNumber);
            fout.println(Fmath.truncate(this.standardizedItemKurtosisExcess[i], this.trunc));
        }
        fout.println();

        fout.print("item ", fieldItemName);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.print("median", fieldItemNumber);
        fout.print("range", fieldItemNumber);
        fout.println("total");

        fout.print("    ", fieldItemName);
        fout.print("    ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("     ");

        for(int i=0; i<this.nItems; i++){
            fout.print(this.itemNames[i], fieldItemName);
            fout.print(Fmath.truncate(this.standardizedItemMinima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedItemMaxima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedItemMedians[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedItemRanges[i], this.trunc), fieldItemNumber);
            fout.println(Fmath.truncate(this.standardizedItemTotals[i], this.trunc));
        }
        fout.println();


        fout.print("item", fieldItemSName);
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("variance", fieldItemNumber);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.println("range");
        fout.print("statistic    ", fieldItemSName);
        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("     ");

        fout.print("item means", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemMeansMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMeansSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMeansVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMeansMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMeansMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemMeansRange, this.trunc));

        fout.print("item standard deviations", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemStandardDeviationsRange, this.trunc));

        fout.print("item variances", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemVariancesMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemVariancesSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemVariancesVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemVariancesMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemVariancesMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemVariancesRange, this.trunc));

        fout.print("item mimima", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemMinimaMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMinimaSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMinimaVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMinimaMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMinimaMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemMinimaRange, this.trunc));

        fout.print("item maxima", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemMaximaMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMaximaSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMaximaVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMaximaMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMaximaMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemMaximaRange, this.trunc));

        fout.print("item medians", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemMediansMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMediansSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMediansVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMediansMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemMediansMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemMediansRange, this.trunc));

        fout.print("item ranges", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemRangesMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemRangesSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemRangesVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemRangesMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemRangesMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemRangesRange, this.trunc));

        fout.print("item totals", fieldItemSName);
        fout.print(Fmath.truncate(this.standardizedItemTotalsMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemTotalsSd, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemTotalsVar, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemTotalsMin, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedItemTotalsMax, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedItemTotalsRange, this.trunc));

        fout.println();


        fout.println("DELETION OF ITEMS");
        int fieldDitem = 16;
        if(fieldItemName>fieldDitem)fieldDitem=fieldItemName;

        fout.print("   ", fieldDitem);
        fout.print("Raw data", fieldItemNumber);
        fout.print("   ", fieldItemNumber);
        fout.print("   ", fieldItemNumber);
        fout.print("   ", fieldItemNumber);
        fout.println("Standardized data");

        fout.print("Deleted item", fieldDitem);
        fout.print("Alpha", fieldItemNumber);
        fout.print("Correlation", fieldItemNumber);
        fout.print("Average", fieldItemNumber);
        fout.print("Average", fieldItemNumber);

        fout.print("Alpha", fieldItemNumber);
        fout.print("Correlation", fieldItemNumber);
        fout.print("Average", fieldItemNumber);
        fout.println("Average");


        fout.print("       ", fieldDitem);
        fout.print("       ", fieldItemNumber);
        fout.print("coefficient", fieldItemNumber);
        fout.print("inter-item", fieldItemNumber);
        fout.print("inter-item", fieldItemNumber);

        fout.print("      ", fieldItemNumber);
        fout.print("coefficient", fieldItemNumber);
        fout.print("inter-item", fieldItemNumber);
        fout.println("inter-item");


        fout.print("       ", fieldDitem);
        fout.print("       ", fieldItemNumber);
        fout.print("with total", fieldItemNumber);
        fout.print("correlation", fieldItemNumber);
        fout.print("correlation", fieldItemNumber);

        fout.print("      ", fieldItemNumber);
        fout.print("with total", fieldItemNumber);
        fout.print("correlation", fieldItemNumber);
        fout.println("correlation");


        fout.print("       ", fieldDitem);
        fout.print("       ", fieldItemNumber);
        fout.print("       ", fieldItemNumber);
        fout.print("coefficient", fieldItemNumber);
        fout.print("coefficient", fieldItemNumber);

        fout.print("        ", fieldItemNumber);
        fout.print("        ", fieldItemNumber);
        fout.print("coefficient", fieldItemNumber);
        fout.println("coefficient");


        fout.print("       ", fieldDitem);
        fout.print("       ", fieldItemNumber);
        fout.print("       ", fieldItemNumber);
        fout.print("without totals", fieldItemNumber);
        fout.print("with totals", fieldItemNumber);

        fout.print("        ", fieldItemNumber);
        fout.print("        ", fieldItemNumber);
        fout.print("without totals", fieldItemNumber);
        fout.println("with totals");

        double[] newRawAlpha = new double[this.nItems];
        double[] newStandardizedAlpha = new double[this.nItems];
        double[] newRawRho = new double[this.nItems];
        double[] newStandardizedRho = new double[this.nItems];
        for(int i=0; i<this.nItems; i++){
            int index = i+1;
            double[][] newScore1 = this.deleteItem(index);
            Cronbach cr = new Cronbach();
            cr.enterScoresAsRowPerPerson(newScore1);
            double rawAlphaD = cr.rawAlpha();
            newRawAlpha[i] = rawAlphaD;
            double rawMeanRhoWithTotalsD = cr.rawAverageCorrelationCoefficientsWithTotals();
            double[] rawPersonTotalsD = cr.rawPersonTotals();
            double rawRhoAgainstTotalsD = Stat.corrCoeff(rawPersonTotalsD, this.scores0[i]);
            double rawMeanRhoWithoutTotalsD = cr.rawAverageCorrelationCoefficients();
            newRawRho[i] = rawRhoAgainstTotalsD;

            double standardizedAlphaD = cr.standardizedAlpha();
            newStandardizedAlpha[i] = standardizedAlphaD;
            double standardizedMeanRhoWithTotalsD = cr.standardizedAverageCorrelationCoefficients();
            double[] standardizedPersonTotalsD = cr.standardizedPersonTotals();
            double standardizedRhoAgainstTotalsD = Stat.corrCoeff(standardizedPersonTotalsD, this.scores0[i]);
            double standardizedMeanRhoWithoutTotalsD = cr.standardizedAverageCorrelationCoefficients();
            newStandardizedRho[i] = standardizedRhoAgainstTotalsD;

            fout.print(this.itemNames[i], fieldDitem);
            fout.print(Fmath.truncate(rawAlphaD, trunc), fieldItemNumber);
            fout.print(Fmath.truncate(rawRhoAgainstTotalsD, trunc), fieldItemNumber);
            fout.print(Fmath.truncate(rawMeanRhoWithoutTotalsD, trunc), fieldItemNumber);
            fout.print(Fmath.truncate(rawMeanRhoWithTotalsD, trunc), fieldItemNumber);

            fout.print(Fmath.truncate(standardizedAlphaD, trunc), fieldItemNumber);
            fout.print(Fmath.truncate(standardizedRhoAgainstTotalsD, trunc), fieldItemNumber);
            fout.print(Fmath.truncate(standardizedMeanRhoWithoutTotalsD, trunc), fieldItemNumber);
            fout.print(Fmath.truncate(standardizedMeanRhoWithTotalsD, trunc), fieldItemNumber);
            fout.println();
        }
        fout.println();

        fout.print("No item deleted", fieldDitem);
        fout.print(Fmath.truncate(this.rawAlpha, trunc), fieldItemNumber);
        fout.print("   ", fieldItemNumber);
        fout.print(Fmath.truncate(this.rawMeanRhoWithoutTotals, trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawMeanRhoWithTotals, trunc), fieldItemNumber);

        fout.print(Fmath.truncate(this.standardizedAlpha, trunc), fieldItemNumber);
        fout.print("   ", fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, trunc));
        fout.println();

        // output a deleted item data file
        this.deletedItemDataFile(newRawAlpha, newRawRho, newStandardizedAlpha, newStandardizedRho);

        int fieldInd = 12;
        fout.println("INDIVIDUALS - raw data");
        fout.print("person", fieldInd);
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.print("range", fieldItemNumber);
        fout.println("total");

        fout.print("    ", fieldInd);
        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("     ");

        int fieldScore = 0;
        for(int i=0; i<this.nItems; i++){
            for(int j=0; j<this.nPersons; j++){
                int sl = Double.toString(scores0[i][j]).length();
                if(sl>fieldScore)fieldScore = sl;
            }
        }
        fieldScore++;
        if(fieldScore<fieldItemName)fieldScore = fieldItemName;
        for(int i=0; i<this.nPersons; i++){
            fout.print((this.personIndices[i]+1), fieldInd);
            fout.print(Fmath.truncate(this.rawPersonMeans[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawPersonStandardDeviations[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawPersonMinima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawPersonMaxima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.rawPersonRanges[i], this.trunc), fieldItemNumber);
            fout.println(Fmath.truncate(this.rawPersonTotals[i], this.trunc));
        }
        fout.println();

        fout.println("scores:");
        fout.print("person ", fieldInd);
        for(int i=0; i<this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
        fout.println();

        for(int i=0; i<this.nPersons; i++){
            fout.print((this.personIndices[i]+1), fieldInd);
            for(int j=0; j<this.nItems; j++)fout.print(Fmath.truncate(this.scores1[i][j], this.trunc), fieldItemNumber);
            fout.println();
        }
        fout.println();

        fout.println("INDIVIDUALS - standardized data");
        fout.print("person ", fieldInd);
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.print("range", fieldItemNumber);
        fout.println("total");


        fout.print("    ", fieldInd);
        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("     ");

        for(int i=0; i<this.nPersons; i++){
            fout.print((this.personIndices[i]+1), fieldInd);
            fout.print(Fmath.truncate(this.standardizedPersonMeans[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedPersonStandardDeviations[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedPersonMinima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedPersonMaxima[i], this.trunc), fieldItemNumber);
            fout.print(Fmath.truncate(this.standardizedPersonRanges[i], this.trunc), fieldItemNumber);
            fout.println(Fmath.truncate(this.standardizedPersonTotals[i], this.trunc));
        }
        fout.println();

        fout.println("scores:");
        fout.print("person ", fieldInd);
        for(int i=0; i<this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
        fout.println();

        for(int i=0; i<this.nPersons; i++){
            fout.print((this.personIndices[i]+1), fieldInd);
            for(int j=0; j<this.nItems; j++)fout.print(Fmath.truncate(this.standardizedScores1[i][j], trunc), fieldItemNumber);
            fout.println();
        }
        fout.println();

        fout.println("ALL SCORES - raw data");
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.print("range", fieldItemNumber);
        fout.println("overall");

        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("total");

        fout.print(Fmath.truncate(this.rawAllResponsesMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawAllResponsesStandardDeviation, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawAllResponsesMinimum, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawAllResponsesMaximum, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.rawAllResponsesRange, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.rawAllResponsesTotal, this.trunc));
        fout.println();

        fout.println("ALL SCORES - standardized data");
        fout.print("mean", fieldItemNumber);
        fout.print("standard", fieldItemNumber);
        fout.print("minimum", fieldItemNumber);
        fout.print("maximum", fieldItemNumber);
        fout.print("range", fieldItemNumber);
        fout.println("overall");

        fout.print("    ", fieldItemNumber);
        fout.print("deviation", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.print("     ", fieldItemNumber);
        fout.println("total");

        fout.print(Fmath.truncate(this.standardizedAllResponsesMean, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedAllResponsesStandardDeviation, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedAllResponsesMinimum, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedAllResponsesMaximum, this.trunc), fieldItemNumber);
        fout.print(Fmath.truncate(this.standardizedAllResponsesRange, this.trunc), fieldItemNumber);
        fout.println(Fmath.truncate(this.standardizedAllResponsesTotal, this.trunc));
        fout.println();


        // close output file
        fout.close();
    }
View Full Code Here

        }
        else{
            this.deletedFilename = "DeletedItemFile.txt";
        }

        FileOutput dfout = new FileOutput(this.deletedFilename);
        String newTitle = title[0] + " - Item " + this.itemNames[this.deletedItemIndex] + " deleted";
        dfout.println(newTitle);
        dfout.println((this.nItems-1));
        dfout.println(this.nPersons);
        for(int i=0; i<this.nItems; i++){
            if(i!=this.deletedItemIndex)dfout.printtab(this.itemNames[i]);
        }
        dfout.println();
        if(this.originalDataType==0){
            for(int i=0; i<this.nItems; i++){
                if(i!=this.deletedItemIndex){
                    for(int j=0; j<this.nPersons; j++){
                        dfout.printtab(this.scores0[i][j]);
                    }
                    dfout.println();
                }
            }
        }
        else{
            for(int j=0; j<this.nPersons; j++){
                for(int i=0; i<this.nItems; i++){
                    if(i!=this.deletedItemIndex){
                        dfout.printtab(this.scores1[j][i]);
                    }
                }
                dfout.println();
            }
        }
        dfout.close();
    }
View Full Code Here

        this.transformedProbabilityPlot();

        int posdot = title.indexOf(".");
        if(posdot==-1)title = title + ".txt";

        FileOutput fout = new FileOutput(title);
        fout.println("Box-Cox Analysis");
        fout.println("File name:   " + title);
        Date d = new Date();
        String day = DateFormat.getDateInstance().format(d);
        String tim = DateFormat.getTimeInstance().format(d);
        fout.println("Program executed at " + tim + " on " + day);
        fout.println();

        int field1 = 30;
        int field2 = 15;
        fout.print("Box-Cox lambda one", field1);
        fout.println(Fmath.truncate(this.lambdaOne, 4));
        fout.print("Box-Cox lambda two", field1);
        fout.println(Fmath.truncate(this.lambdaTwo, 4));
        fout.println();

        fout.print("  ", field1);
        fout.print("Transformed", field2);
        fout.print("  ", field2);
        fout.println("Original   ");
        fout.print("  ", field1);
        fout.print("scaled data", field2);
        fout.print("  ", field2);
        fout.println("data   ");
        fout.println();

        fout.print("                            ", field1);
        fout.print("Value", field2);
        fout.print("Error", field2);
        fout.print("Value", field2);
        fout.println("Error");
        fout.println();

        fout.println("Gaussian Probability plot ");
        fout.print("  Correlation coefficient", field1);
        fout.print(Fmath.truncate(this.transformedSampleR, 4), field2);
        fout.print(" ", field2);
        fout.println(Fmath.truncate(this.originalSampleR, 4));

        fout.print("  Gradient", field1);
        fout.print(Fmath.truncate(this.transformedGradient, 4), field2);
        fout.print(Fmath.truncate(this.transformedGradientError, 4), field2);
        fout.print(Fmath.truncate(this.originalGradient, 4), field2);
        fout.println(Fmath.truncate(this.originalGradientError, 4));

        fout.print("  Intercept", field1);
        fout.print(Fmath.truncate(this.transformedIntercept, 4), field2);
        fout.print(Fmath.truncate(this.transformedInterceptError, 4), field2);
        fout.print(Fmath.truncate(this.originalIntercept, 4), field2);
        fout.println(Fmath.truncate(this.originalInterceptError, 4));
        fout.println();

        fout.print("Data ");
        fout.println();
        fout.print("  Mean", field1);
        fout.print(Fmath.truncate(this.transformedMean, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMean, 4));

        fout.print("  Median", field1);
        fout.print(Fmath.truncate(this.transformedMedian, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMedian, 4));

        fout.print("  Standard deviation", field1);
        fout.print(Fmath.truncate(this.transformedStandardDeviation, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalStandardDeviation, 4));

        fout.print("  Standard error", field1);
        fout.print(Fmath.truncate(this.transformedStandardDeviation/Math.sqrt(this.nData), 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalStandardDeviation/Math.sqrt(this.nData), 4));

        fout.print("  Moment skewness", field1);
        fout.print(Fmath.truncate(this.transformedMomentSkewness, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMomentSkewness, 4));

        fout.print("  Median skewness", field1);
        fout.print(Fmath.truncate(this.transformedMedianSkewness, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMedianSkewness, 4));

        fout.print("  Quartile skewness", field1);
        fout.print(Fmath.truncate(this.transformedQuartileSkewness, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalQuartileSkewness, 4));

        fout.print("  Excess kurtosis", field1);
        fout.print(Fmath.truncate(this.transformedExcessKurtosis, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalExcessKurtosis, 4));

        fout.print("  Minimum", field1);
        fout.print(Fmath.truncate(this.transformedMinimum, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMinimum, 4));

        fout.print("  Maximum", field1);
        fout.print(Fmath.truncate(this.transformedMaximum, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalMaximum, 4));

        fout.print("  Range", field1);
        fout.print(Fmath.truncate(this.transformedRange, 4), field2);
        fout.print("  ", field2);
        fout.println(Fmath.truncate(this.originalRange, 4));

        fout.close();
    }
View Full Code Here

  // File name provided
  // prec = truncation precision
  public void print(String filename){

      if(filename.indexOf('.')==-1)filename = filename+".txt";
      FileOutput fout = new FileOutput(filename, 'n');
      fout.dateAndTimeln(filename);
      fout.println(" ");
      fout.println("Simplex minimisation, using the method of Nelder and Mead,");
        fout.println("of the function y = f(c[0], c[1], c[2] . . .)");
      this.paraName = new String[this.nParam];
        for(int i=0;i<this.nParam;i++)this.paraName[i]="c["+i+"]";

        fout.println();
        if(!this.convStatus){
            fout.println("Convergence criterion was not satisfied");
            fout.println("The following results are the current estimates on exiting the minimisation method");
            fout.println();
        }

        fout.println("Value of parameters at the minimum");
        fout.println(" ");

        fout.printtab(" ", this.field);
        fout.printtab("Value at", this.field);
        fout.printtab("Initial", this.field);
        fout.println("Initial");

        fout.printtab(" ", this.field);
        fout.printtab("mimium", this.field);
        fout.printtab("estimate", this.field);
        fout.println("step");

        for(int i=0; i<this.nParam; i++){
            fout.printtab(this.paraName[i], this.field);
            fout.printtab(Fmath.truncate(paramValue[i],this.prec), this.field);
             fout.printtab(Fmath.truncate(this.startH[i],this.prec), this.field);
            fout.println(Fmath.truncate(this.step[i],this.prec));
        }
        fout.println();

      fout.println(" ");

        fout.printtab("Number of paramaters");
    fout.println(this.nParam);
        fout.printtab("Number of iterations taken");
        fout.println(this.nIter);
        fout.printtab("Maximum number of iterations allowed");
        fout.println(this.nMax);
        fout.printtab("Number of restarts taken");
        fout.println(this.kRestart);
        fout.printtab("Maximum number of restarts allowed");
        fout.println(this.konvge);
        fout.printtab("Standard deviation of the simplex at the minimum");
        fout.println(Fmath.truncate(this.simplexSd, this.prec));
        fout.printtab("Convergence tolerance");
        fout.println(this.fTol);
        switch(minTest){
            case 0: if(this.convStatus){
                        fout.println("simplex sd < the tolerance");
                    }
                    else{
                        fout.println("NOTE!!! simplex sd > the tolerance");
                    }
                    break;
        }
        fout.println();
        fout.println("End of file");
    fout.close();
  }
View Full Code Here

  // File name provided
  // prec = truncation precision
  public void print(String filename){

      if(filename.indexOf('.')==-1)filename = filename+".txt";
      FileOutput fout = new FileOutput(filename, 'n');
      fout.dateAndTimeln(filename);
      fout.println(" ");
      fout.println("Simplex maximisation, using the method of Nelder and Mead,");
        fout.println("of the function y = f(c[0], c[1], c[2] . . .)");
      this.paraName = new String[this.nParam];
        for(int i=0;i<this.nParam;i++)this.paraName[i]="c["+i+"]";

        fout.println();
        if(!this.convStatus){
            fout.println("Convergence criterion was not satisfied");
            fout.println("The following results are the current estimates on exiting the maximisation method");
            fout.println();
        }

        fout.println("Value of parameters at the maximum");
        fout.println(" ");

        fout.printtab(" ", this.field);
        fout.printtab("Value at", this.field);
        fout.printtab("Initial", this.field);
        fout.println("Initial");

        fout.printtab(" ", this.field);
        fout.printtab("maximium", this.field);
        fout.printtab("estimate", this.field);
        fout.println("step");

        for(int i=0; i<this.nParam; i++){
            fout.printtab(this.paraName[i], this.field);
            fout.printtab(Fmath.truncate(paramValue[i],this.prec), this.field);
            fout.printtab(Fmath.truncate(this.startH[i],this.prec), this.field);
            fout.println(Fmath.truncate(this.step[i],this.prec));
        }
        fout.println();

      fout.println(" ");

        fout.printtab("Number of paramaters");
    fout.println(this.nParam);
        fout.printtab("Number of iterations taken");
        fout.println(this.nIter);
        fout.printtab("Maximum number of iterations allowed");
        fout.println(this.nMax);
        fout.printtab("Number of restarts taken");
        fout.println(this.kRestart);
        fout.printtab("Maximum number of restarts allowed");
        fout.println(this.konvge);
        fout.printtab("Standard deviation of the simplex at the maximum");
        fout.println(Fmath.truncate(this.simplexSd, this.prec));
        fout.printtab("Convergence tolerance");
        fout.println(this.fTol);
        switch(maxTest){
            case 0: if(this.convStatus){
                        fout.println("simplex sd < the tolerance");
                    }
                    else{
                        fout.println("NOTE!!! simplex sd > the tolerance");
                    }
                    break;
        }
        fout.println();
        fout.println("End of file");
    fout.close();
  }
View Full Code Here

TOP

Related Classes of flanagan.io.FileOutput

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.