/*
*   CLASS:      Scores
*
*   USAGE:      Class for entering scores (responses) for several items,
*               e.g. questionnaire questions, examination questions
*               This is superclass for several educational statistics classes,
*               e.g. Cronbach
*
*   WRITTEN BY: Dr Michael Thomas Flanagan
*
*   DATE:       October 2008
*   AMENDED:    12 October 2008, 1-18 November 2010, 27 November 2010, 3-4 December 2010
*               7 December 2011 
*
*   DOCUMENTATION:
*   See Michael Thomas Flanagan's Java library on-line web pages:
*   http://www.ee.ucl.ac.uk/~mflanaga/java/
*   http://www.ee.ucl.ac.uk/~mflanaga/java/Cronbach.html
*
*   Copyright (c) 2008-2011 Michael Thomas Flanagan
*
*   PERMISSION TO COPY:
*
* Permission to use, copy and modify this software and its documentation for NON-COMMERCIAL purposes is granted, without fee,
* provided that an acknowledgement to the author, Dr Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga, appears in all copies
* and associated documentation or publications.
*
* Redistributions of the source code of this source code, or parts of the source codes, must retain the above copyright notice, this list of conditions
* and the following disclaimer and requires written permission from the Michael Thomas Flanagan:
*
* Redistribution in binary form of all or parts of this class must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution and requires written permission from the Michael Thomas Flanagan:
*
* Dr Michael Thomas Flanagan makes no representations about the suitability or fitness of the software for any or for a particular purpose.
* Dr Michael Thomas Flanagan shall not be liable for any damages suffered as a result of using, modifying or distributing this software
* or its derivatives.
*
***************************************************************************************/


package flanagan.analysis;

import java.util.*;
import java.text.*;

import flanagan.math.*;
import flanagan.io.*;
import flanagan.analysis.*;
import flanagan.plot.*;


public class Scores{

    protected String[] title =null;                                                 // title
    protected int titleLines = 0;                                                   // number of lines in the title

    protected String inputFilename = null;                                          // input file name if input data read from file
    protected String outputFilename = null;                                         // output file name if output written to file
    protected int fileOption = 1;                                                   // type of file option
                                                                                    // option = 1 - text file  (.txt)
                                                                                    // option = 2 - MS Excel file (.xls)
    protected boolean fileOptionSet = false;                                        // = true if fileOption changed by user
    protected String[] fileExtensions = {".txt", ".xls"};                           // Output file extensions
    protected boolean fileNumberingSet = false;                                     // = output file of identical name to existing file overwrites existing file
                                                                                    // = true incremented number added to output file name to prevent overwriting
    protected int trunc = 6;                                                        // number of decimal places in output data
                                                                                    // overriden by the precision of the input data if this is greater
    protected boolean truncAll = false;                                             // if true - the above truncation is not overriden by the precision of the input data if this is greater

    protected int originalDataType = -1;                                            // = 1 - String[][]  (including read from file);
                                                                                    // = 2 - double[][]
                                                                                    // = 3 - Matrix
                                                                                    // = 4 - float[][]
                                                                                    // = 5 - int[][]
                                                                                    // = 6 - char[][]
                                                                                    // = 7 - boolean[][]

    protected int originalDataOrder = -1;                                           // = 0 - matrix columns = responses of a person
                                                                                    // = 1 - matrix rows = responses of a person to each item

    protected Object originalData = null;                                           // Original data as entered

    protected double[][]scores0 = null;                                             // individual scores -  after any 'no response' deletions or replacements
                                                                                    // arranged as rows of scores for each item
                                                                                    // e.g. scores0[0][0] to scores0[0][nIndividuals-1] =  scores for each person in turn for the first item
                                                                                    //      scores0[1][0] to scores0[1][nIndividuals-1] =  scores for each person in turn for the second item
                                                                                    // etc.
    protected double[][]originalScores0 = null;                                     // scores0 before any 'no response' deletions or replacements
    protected double[][]standardizedScores0 = null;                                 // standardized scores0

    protected double[][]scores1 = null;                                             // individual scores -  after any 'no response' deletions or replacements
                                                                                    // arranged as rows of scores for each person
                                                                                    // e.g. scores1[0][0] to scores1[0][nItems-1] =  scores for each item in turn for the first person
                                                                                    //      scores1[1][0] to scores1[1][nItems-1] =  scores for each item in turn for the second person
                                                                                    // etc.
    protected double[][]originalScores1 = null;                                     // scores1 before any 'no response' deletions or replacements
    protected double[][]standardizedScores1 = null;                                 // standardized scores1

    protected boolean dataEntered = false;                                          // = true when scores entered
    protected boolean dataPreprocessed = false;                                     // = true when scores have been preprocessed

    protected int nItems = 0;                                                       // number of items, after any deletions
    protected int originalNitems = 0;                                               // original number of items
    protected String[] itemNames = null;                                            // names of the items
    protected String[] originalItemNames = null;                                    // list of item names before any deletions
    protected boolean itemNamesSet = false;                                         // = true when item names entered

    protected int nPersons = 0;                                                     // number of persons, after any deletions
    protected int originalNpersons = 0;                                             // original number of persons
    protected String[] personNames = null;                                          // names of the persons

    protected int nScores = 0;                                                      // total number of scores, after any deletions, for each item
    protected int originalNscores = 0;                                              // original total number of scores for each item
    
    protected String otherFalse = null;                                             // false value for dichotomous data if one of the default values
    protected String otherTrue = null;                                              // true value for dichotomous data if one of the default values
                                                                                    // default values: a numeral, true (ignoring case), false (ignoring case), yes (ignoring case), no (ignoring case)
    protected boolean otherDichotomousDataSet = false;                              // = true if user sets an alternative dichotomous pair
    protected boolean[] dichotomous = null;                                         // true if the data in an item is dichotomous
    protected double[] dichotomousPercentage = null;                                // percentage of responses in an item that are dichotomous
    protected boolean dichotomousOverall = false;                                   // true if all the data is dichotomous
    protected boolean dichotomousCheckDone = false;                                 // true if check for dichotomous data performed

    protected boolean letterToNumeralSet = true;                                    // = true if user set the letter to numeral option allowing alphabetic response input

    protected boolean ignoreNoResponseRequests = false;                             // = true - requests for 'no resonse' options are not displayed

    protected double itemDeletionPercentage = 100.0;                                // percentage of no responses allowed within an item before the item is deleted
    protected boolean itemDeletionPercentageSet = false;                            // = true when this percentage is reset

    protected double personDeletionPercentage = 100.0;                              // percentage of no responses allowed within a person's responses before the person is deleted
    protected boolean personDeletionPercentageSet = false;                          // = true when this percentage is reset

    protected int replacementOption = 3;                                            // option flag for a missing response if deletion not carried out
                                                                                    // option = 1 - score replaced by zero
                                                                                    // option = 2 - score replaced by person's mean
                                                                                    // option = 3 - score replaced by item mean (default option)
                                                                                    // option = 4 - score replaced by overall mean
                                                                                    // option = 5 - user supplied score for each 'no response'

    protected String[] replacementOptionNames = {"score replaced by zero", "score replaced by person's mean", "score replaced by item mean", "score replaced by overall mean", "user supplied score for each 'no response'"};

    protected boolean replacementOptionSet = false;                                 // = true when replacementOption set
    protected boolean allNoResponseOptionsSet = false;                              // = true when personDeletionPercentageSet, itemDeletionPercentageSet and replacementOptionSet are all true
    protected boolean noResponseHandlingSet = false;                                // = true when 'no response' handling options are all set

    protected int nNaN = 0;                                                         // number of 'no responses' (initially equated to NaN)
    protected boolean[] deletedItems = null;                                        // = true if item corresponding to the deletedItems array index has been deleted, false otherwise
    protected int nDeletedItems = 0;                                                // number of deleted items
    protected int[] deletedItemsIndices = null;                                     // indices of the deleted items
    protected int[] itemIndices = null;                                             // indices of items in original data before deletions

    protected boolean[] deletedPersons = null;                                      // = true if person corresponding to the deletedItems array index has been deleted, false otherwise
                                                                                    //   person deleted if no response in all items,then deleted irrespective of missing response option choice
    protected int nDeletedPersons = 0;                                              // number of deleted persons
    protected int[] deletedPersonsIndices = null;                                   // indices of the deleted persons
    protected int[] personIndices = null;                                           // indices of persons in original data before deletions

    protected int nReplacements = 0;                                                // number of 'no response' replacements
    protected String[] replacementIndices = null;                                   // indices of 'no response' replacements

    protected double[] rawItemMeans = null;                                         // means of the responses in each item (raw data)
    protected double rawItemMeansMean = Double.NaN;                                 // mean of the means of the responses in each item (raw data)
    protected double rawItemMeansSd = Double.NaN;                                   // standard deviation of the means of the responses in each item (raw data)
    protected double rawItemMeansVar = Double.NaN;                                  // variance of the means of the responses in each item (raw data)
    protected double rawItemMeansMin = Double.NaN;                                  // minimum of the means of the responses in each item (raw data)
    protected double rawItemMeansMax = Double.NaN;                                  // maximum of the means of the responses in each item (raw data)
    protected double rawItemMeansRange = Double.NaN;                                // range of the means of the responses in each item (raw data)

    protected double[] rawItemStandardDeviations = null;                            // standard deviations of the responses in each item (raw data)
    protected double rawItemStandardDeviationsMean = Double.NaN;                    // mean of the StandardDeviations of the responses in each item (raw data)
    protected double rawItemStandardDeviationsSd = Double.NaN;                      // standard deviation of the Standard Deviations of the responses in each item (raw data)
    protected double rawItemStandardDeviationsVar = Double.NaN;                     // variance of the Standard Deviations of the responses in each item (raw data)
    protected double rawItemStandardDeviationsMin = Double.NaN;                     // minimum of the Standard Deviations of the responses in each item (raw data)
    protected double rawItemStandardDeviationsMax = Double.NaN;                     // maximum of the Standard Deviations of the responses in each item (raw data)
    protected double rawItemStandardDeviationsRange = Double.NaN;                   // range of the Standard Deviations of the responses in each item (raw data)

    protected double[] rawItemVariances = null;                                     // variances of the responses in each item (raw data)
    protected double rawItemVariancesMean = Double.NaN;                             // mean of the Variances of the responses in each item (raw data)
    protected double rawItemVariancesSd = Double.NaN;                               // standard deviation of the Variances of the responses in each item (raw data)
    protected double rawItemVariancesVar = Double.NaN;                              // variance of the Variances of the responses in each item (raw data)
    protected double rawItemVariancesMin = Double.NaN;                              // minimum of the Variances of the responses in each item (raw data)
    protected double rawItemVariancesMax = Double.NaN;                              // maximum of the Variances of the responses in each item (raw data)
    protected double rawItemVariancesRange = Double.NaN;                            // range of the Variances of the responses in each item (raw data)

    protected double[] rawItemMinima = null;                                        // minima of the responses in each item (raw data)
    protected double rawItemMinimaMean = Double.NaN;                                // mean of the Minima of the responses in each item (raw data)
    protected double rawItemMinimaSd = Double.NaN;                                  // standard deviation of the Minima of the responses in each item (raw data)
    protected double rawItemMinimaVar = Double.NaN;                                 // variance of the Minima of the responses in each item (raw data)
    protected double rawItemMinimaMin = Double.NaN;                                 // minimum of the Minima of the responses in each item (raw data)
    protected double rawItemMinimaMax = Double.NaN;                                 // maximum of the Minima of the responses in each item (raw data)
    protected double rawItemMinimaRange = Double.NaN;                               // range of the Minima of the responses in each item (raw data)

    protected double[] rawItemMaxima = null;                                        // maxima of the responses in each item (raw data)
    protected double rawItemMaximaMean = Double.NaN;                                // mean of the Maxima of the responses in each item (raw data)
    protected double rawItemMaximaSd = Double.NaN;                                  // standard deviation of the Maxima of the responses in each item (raw data)
    protected double rawItemMaximaVar = Double.NaN;                                 // variance of the Maxima of the responses in each item (raw data)
    protected double rawItemMaximaMin = Double.NaN;                                 // minimum of the Maxima of the responses in each item (raw data)
    protected double rawItemMaximaMax = Double.NaN;                                 // maximum of the Maxima of the responses in each item (raw data)
    protected double rawItemMaximaRange = Double.NaN;                               // range of the Maxima of the responses in each item (raw data)

    protected double[] rawItemRanges = null;                                        // Ranges of the responses in each item (raw data)
    protected double rawItemRangesMean = Double.NaN;                                // mean of the Ranges of the responses in each item (raw data)
    protected double rawItemRangesSd = Double.NaN;                                  // standard deviation of the Ranges of the responses in each item (raw data)
    protected double rawItemRangesVar = Double.NaN;                                 // variance of the Ranges of the responses in each item (raw data)
    protected double rawItemRangesMin = Double.NaN;                                 // minimum of the Ranges of the responses in each item (raw data)
    protected double rawItemRangesMax = Double.NaN;                                 // maximum of the Ranges of the responses in each item (raw data)
    protected double rawItemRangesRange = Double.NaN;                               // range of the Ranges of the responses in each item (raw data)

    protected double[] rawItemTotals = null;                                        // totals of the responses in each item (raw data)
    protected double rawItemTotalsMean = Double.NaN;                                // mean of the Totals of the responses in each item (raw data)
    protected double rawItemTotalsSd = Double.NaN;                                  // standard deviation of the Totals of the responses in each item (raw data)
    protected double rawItemTotalsVar = Double.NaN;                                 // variance of the Totals of the responses in each item (raw data)
    protected double rawItemTotalsMin = Double.NaN;                                 // minimum of the Totals of the responses in each item (raw data)
    protected double rawItemTotalsMax = Double.NaN;                                 // maximum of the Totals of the responses in each item (raw data)
    protected double rawItemTotalsRange = Double.NaN;                               // range of the Totals of the responses in each item (raw data)

    protected double[] rawItemMedians = null;                                       // medians of the sorted responses in each item (raw data)
    protected double rawItemMediansMean = Double.NaN;                               // mean of the Medians of the responses in each item (raw data)
    protected double rawItemMediansSd = Double.NaN;                                 // standard deviation of the Medians of the responses in each item (raw data)
    protected double rawItemMediansVar = Double.NaN;                                // variance of the Medians of the responses in each item (raw data)
    protected double rawItemMediansMin = Double.NaN;                                // minimum of the Medians of the responses in each item (raw data)
    protected double rawItemMediansMax = Double.NaN;                                // maximum of the Medians of the responses in each item (raw data)
    protected double rawItemMediansRange = Double.NaN;                              // range of the Medians of the responses in each item (raw data)

    protected double[] rawItemMomentSkewness = null;                                // Moment skewness of the  responses in each item (raw data)
    protected double[] rawItemMedianSkewness = null;                                // Median skewness of the  responses in each item (raw data)
    protected double[] rawItemQuartileSkewness = null;                              // Quartile skewness of the  responses in each item (raw data)
    protected double[] rawItemKurtosisExcess = null;                                // Kurtosis excess of the  responses in each item (raw data)

    protected double[] rawPersonMeans = null;                                       // means of the responses for each person  (raw data)
    protected double[] rawPersonStandardDeviations = null;                          // standard deviations of the responses for each person (raw data)
    protected double[] rawPersonVariances = null;                                   // variances of the responses for each person (raw data)
    protected double[] rawPersonMinima = null;                                      // minima of the responses for each person (raw data)
    protected double[] rawPersonMaxima = null;                                      // maxima of the responses for each person (raw data)
    protected double[] rawPersonRanges = null;                                      // ranges of the responses for each person (raw data)
    protected double[] rawPersonTotals = null;                                      // totals of the responses for each person (raw data)

    protected double rawAllResponsesMean = Double.NaN;                              // mean of all the responses  (raw data)
    protected double rawAllResponsesStandardDeviation = Double.NaN;                 // standard deviation of all the responses  (raw data)
    protected double rawAllResponsesVariance = Double.NaN;                          // variance of all the responses (raw data)
    protected double rawAllResponsesMinimum = Double.NaN;                           // minimum of all the responses (raw data)
    protected double rawAllResponsesMaximum = Double.NaN;                           // maximum of all the responses (raw data)
    protected double rawAllResponsesRange = Double.NaN;                             // ranges of all the responses (raw data)
    protected double rawAllResponsesTotal = Double.NaN;                             // total of all the responses (raw data)

    protected double[][] rawCovariances = null;                                     // covariances between items  (raw data)
    protected double[][] rawCorrelationCoefficients = null;                         // correlation coefficients between items  (raw data)
    protected double[] rawRhosWithTotal = null;                                     // correlation coefficient of an item with the itemtotals  (raw data)
    protected double rawMeanRhoWithTotals = Double.NaN;                             // average inter-item correlation coeffecient including totals (raw data)
    protected double rawStandardDeviationRhoWithTotals = Double.NaN;                // standard deviation of inter-item correlation coeffecient including totals (raw data)
    protected double rawMeanRhoWithoutTotals = Double.NaN;                          // average inter-item correlation coeffecient excluding totals (raw data)
    protected double rawStandardDeviationRhoWithoutTotals = Double.NaN;             // standard deviation of inter-item correlation coeffecient excluding totals (raw data)

    protected double[] standardizedItemMeans = null;                                // means of the responses in each item (standardized data)
    protected double standardizedItemMeansMean = Double.NaN;                        // mean of the means of the responses in each item (standardized data)
    protected double standardizedItemMeansSd = Double.NaN;                          // standard deviation of the means of the responses in each item (standardized data)
    protected double standardizedItemMeansVar = Double.NaN;                         // variance of the means of the responses in each item (standardized data)
    protected double standardizedItemMeansMin = Double.NaN;                         // minimum of the means of the responses in each item (standardized data)
    protected double standardizedItemMeansMax = Double.NaN;                         // maximum of the means of the responses in each item (standardized data)
    protected double standardizedItemMeansRange = Double.NaN;                       // range of the means of the responses in each item (standardized data)

    protected double[] standardizedItemStandardDeviations = null;                   // standard deviations of the responses in each item (standardized data)
    protected double standardizedItemStandardDeviationsMean = Double.NaN;           // mean of the Standard Deviations of the responses in each item (standardized data)
    protected double standardizedItemStandardDeviationsSd = Double.NaN;             // standard deviation of the Standard Deviations of the responses in each item (standardized data)
    protected double standardizedItemStandardDeviationsVar = Double.NaN;            // variance of the Standard Deviations of the responses in each item (standardized data)
    protected double standardizedItemStandardDeviationsMin = Double.NaN;            // minimum of the Standard Deviations of the responses in each item (standardized data)
    protected double standardizedItemStandardDeviationsMax = Double.NaN;            // maximum of the Standard Deviations of the responses in each item (standardized data)
    protected double standardizedItemStandardDeviationsRange = Double.NaN;          // range of the Standard Deviations of the responses in each item (standardized data)

    protected double[] standardizedItemVariances = null;                            // variances of the responses in each item (standardized data)
    protected double standardizedItemVariancesMean = Double.NaN;                    // mean of the Variances of the responses in each item (standardized data)
    protected double standardizedItemVariancesSd = Double.NaN;                      // standard deviation of the Variances of the responses in each item (standardized data)
    protected double standardizedItemVariancesVar = Double.NaN;                     // variance of the Variances of the responses in each item (standardized data)
    protected double standardizedItemVariancesMin = Double.NaN;                     // minimum of the Variances of the responses in each item (standardized data)
    protected double standardizedItemVariancesMax = Double.NaN;                     // maximum of the Variances of the responses in each item (standardized data)
    protected double standardizedItemVariancesRange = Double.NaN;                   // range of the Variances of the responses in each item (standardized data)

    protected double[] standardizedItemMinima = null;                               // minima of the responses in each item (standardized data)
    protected double standardizedItemMinimaMean = Double.NaN;                       // mean of the Minima of the responses in each item (standardized data)
    protected double standardizedItemMinimaSd = Double.NaN;                         // standard deviation of the Minima of the responses in each item (standardized data)
    protected double standardizedItemMinimaVar = Double.NaN;                        // variance of the Minima of the responses in each item (standardized data)
    protected double standardizedItemMinimaMin = Double.NaN;                        // minimum of the Minima of the responses in each item (standardized data)
    protected double standardizedItemMinimaMax = Double.NaN;                        // maximum of the Minima of the responses in each item (standardized data)
    protected double standardizedItemMinimaRange = Double.NaN;                      // range of the Minima of the responses in each item (standardized data)

    protected double[] standardizedItemMaxima = null;                               // maxima of the responses in each item (standardized data)
    protected double standardizedItemMaximaMean = Double.NaN;                       // mean of the Maxima of the responses in each item (standardized data)
    protected double standardizedItemMaximaSd = Double.NaN;                         // standard deviation of the Maxima of the responses in each item (standardized data)
    protected double standardizedItemMaximaVar = Double.NaN;                        // variance of the Maxima of the responses in each item (standardized data)
    protected double standardizedItemMaximaMin = Double.NaN;                        // minimum of the Maxima of the responses in each item (standardized data)
    protected double standardizedItemMaximaMax = Double.NaN;                        // maximum of the Maxima of the responses in each item (standardized data)
    protected double standardizedItemMaximaRange = Double.NaN;                      // range of the Maxima of the responses in each item (standardized data)

    protected double[] standardizedItemRanges = null;                               // Ranges of the responses in each item (standardized data)
    protected double standardizedItemRangesMean = Double.NaN;                       // mean of the Ranges of the responses in each item (standardized data)
    protected double standardizedItemRangesSd = Double.NaN;                         // standard deviation of the Ranges of the responses in each item (standardized data)
    protected double standardizedItemRangesVar = Double.NaN;                        // variance of the Ranges of the responses in each item (standardized data)
    protected double standardizedItemRangesMin = Double.NaN;                        // minimum of the Ranges of the responses in each item (standardized data)
    protected double standardizedItemRangesMax = Double.NaN;                        // maximum of the Ranges of the responses in each item (standardized data)
    protected double standardizedItemRangesRange = Double.NaN;                      // range of the Ranges of the responses in each item (standardized data)

    protected double[] standardizedItemTotals = null;                               // totals of the responses in each item (standardized data)
    protected double standardizedItemTotalsMean = Double.NaN;                       // mean of the Totals of the responses in each item (standardized data)
    protected double standardizedItemTotalsSd = Double.NaN;                         // standard deviation of the Totals of the responses in each item (standardized data)
    protected double standardizedItemTotalsVar = Double.NaN;                        // variance of the Totals of the responses in each item (standardized data)
    protected double standardizedItemTotalsMin = Double.NaN;                        // minimum of the Totals of the responses in each item (standardized data)
    protected double standardizedItemTotalsMax = Double.NaN;                        // maximum of the Totals of the responses in each item (standardized data)
    protected double standardizedItemTotalsRange = Double.NaN;                      // range of the Totals of the responses in each item (standardized data)

    protected double[] standardizedItemMedians = null;                              // medians of the sorted responses in each item (standardized  data)
    protected double standardizedItemMediansMean = Double.NaN;                      // mean of the Medians of the responses in each item (standardized data)
    protected double standardizedItemMediansSd = Double.NaN;                        // standard deviation of the Medians of the responses in each item (standardized data)
    protected double standardizedItemMediansVar = Double.NaN;                       // variance of the Medians of the responses in each item (standardized data)
    protected double standardizedItemMediansMin = Double.NaN;                       // minimum of the Medians of the responses in each item (standardized data)
    protected double standardizedItemMediansMax = Double.NaN;                       // maximum of the Medians of the responses in each item (standardized data)
    protected double standardizedItemMediansRange = Double.NaN;                     // range of the Medians of the responses in each item (standardized data)

    protected double[] standardizedItemMomentSkewness = null;                       // Moment skewness of the  responses in each item (standardized data)
    protected double[] standardizedItemMedianSkewness = null;                       // Median skewness of the  responses in each item (standardized data)
    protected double[] standardizedItemQuartileSkewness = null;                     // Quartile skewness of the  responses in each item (standardized data)
    protected double[] standardizedItemKurtosisExcess = null;                       // Kurtosis excess of the  responses in each item (standardized data)

    protected double[] standardizedPersonMeans = null;                              // mean of the responses for each person  (standardized data)
    protected double[] standardizedPersonStandardDeviations = null;                 // standard deviation of the responses for each person (standardized data)
    protected double[] standardizedPersonVariances = null;                          // variance of the responses for each person (standardized data)
    protected double[] standardizedPersonMinima = null;                             // minima of the responses for each person (standardized data)
    protected double[] standardizedPersonMaxima = null;                             // maxima of the responses for each person (standardized data)
    protected double[] standardizedPersonRanges = null;                             // ranges of the responses for each person (standardized data)
    protected double[] standardizedPersonTotals = null;                             // totals of the responses for each person (standardized data)

    protected double standardizedAllResponsesMean = Double.NaN;                     // means of all the responses  (standardized data)
    protected double standardizedAllResponsesStandardDeviation = Double.NaN;        // standard deviations of all the responses  (standardized data)
    protected double standardizedAllResponsesVariance = Double.NaN;                 // variances of all the responses (standardized data)
    protected double standardizedAllResponsesMinimum = Double.NaN;                  // minimum of all the responses (standardized data)
    protected double standardizedAllResponsesMaximum = Double.NaN;                  // maximum of all the responses (standardized data)
    protected double standardizedAllResponsesRange = Double.NaN;                    // range of all the responses (standardized data)
    protected double standardizedAllResponsesTotal = Double.NaN;                    // total of all the responses (standardized data)

    protected double[][] standardizedCovariances = null;                            // covariances between items  (standardized data)
    protected double[][] standardizedCorrelationCoefficients = null;                // correlation coefficients between items  (standardized data)
    protected double[] standardizedRhosWithTotal = null;                            // correlation coefficient of an item with the itemtotals  (standardized data)
    protected double standardizedMeanRhoWithTotals = Double.NaN;                    // average inter-item correlation coeffecient including totals (standardized data)
    protected double standardizedStandardDeviationRhoWithTotals = Double.NaN;       // standard deviation of nter-item correlation coeffecient including totals (standardized data)
    protected double standardizedMeanRhoWithoutTotals = Double.NaN;                 // average inter-item correlation coeffecient excluding totals (standardized data)
    protected double standardizedStandardDeviationRhoWithoutTotals = Double.NaN;    // standard deviation of inter-item correlation coeffecient excluding totals (standardized data)

    protected boolean variancesCalculated = false;                                  // = true when means, variances and standard deviations calculated
    protected boolean covariancesCalculated = false;                                // = true when covariances and correlation coefficients calculated

    protected boolean nFactorOption = false;                                        // = true  varaiance, covariance and standard deviation denominator = n
                                                                                    // = false varaiance, covariance and standard deviation denominator = n-1

    protected int sameCheck = 0;                                                    // = 0;     no row or column with identical elements in the data matrix
                                                                                    // = 1;     row/s of identical elements found
                                                                                    // = 2;     column/s of identical elements found
                                                                                    // = 3;     row/s and column/s of identical elements found

    // CONSTRUCTOR
    public Scores(){
    }

    // TITLE
    // Enter title (optional)
    public void enterTitle(String title){
        if(this.title==null){
            this.title = new String[2];
            this.title[0] = "Title: " + title;
            Date d = new Date();
            String day = DateFormat.getDateInstance().format(d);
            String tim = DateFormat.getTimeInstance().format(d);
            this.title[1] = "Program execution initiated at " + tim + " on " + day;
        }
        else{
            this.title[0] =  title;
        }
    }

    // MISSING RESPONSE
    // Set percentage of no responses allowed within a person's responses before deletion of the person performed
    public void setPersonDeletionPercentage(double perCent){
        this.personDeletionPercentage = perCent;
        this.personDeletionPercentageSet = true;
        if(this.itemDeletionPercentageSet && this.replacementOptionSet){
            this.allNoResponseOptionsSet = true;
            if(this.dataEntered){
                this.preprocessData();
            }
        }
    }

    // Set percentage of no responses allowed within an item before deletion of the item performed
    public void setItemDeletionPercentage(double perCent){
        this.itemDeletionPercentage = perCent;
        this.itemDeletionPercentageSet = true;
        if(this.personDeletionPercentageSet && this.replacementOptionSet){
            this.allNoResponseOptionsSet = true;
            if(this.dataEntered){
                this.preprocessData();
            }
        }
    }

    // Set missing response option if deletion of item not carried out
    // option = 1 - score replaced by zero
    // option = 2 - score replaced by person's mean
    // option = 3 - score replaced by item mean (default option)
    // option = 4 - score replaced by overall mean
    // option = 5 - user supplied score for each 'no response'
    // requires data to be entered as a String matrix or from text file
    // default option = 2
    public void setMissingDataOption(int option){
        if(option<1 || option>5)throw new IllegalArgumentException("The missing response option entered is " + option + "; the option must be 1, 2, 3, 4 or 5");
        this.replacementOption = option;
        this.replacementOptionSet = true;
        if(this.personDeletionPercentageSet && this.itemDeletionPercentageSet){
            this.allNoResponseOptionsSet = true;
            if(this.dataEntered){
                this.preprocessData();
            }
        }
    }

    // Ignore requests for deletion percentages and replacement options
    public void ignoreMissingDataOptionRequests(){
        this.ignoreNoResponseRequests = true;
        this.allNoResponseOptionsSet = true;
        this.itemDeletionPercentageSet = true;
        this.personDeletionPercentageSet = true;
        this.allNoResponseOptionsSet = true;
    }


    // Handling of 'no responses'
    // Checks for and carries out item and/or person deletion
    // checks for and carries out no response replacements
    protected void noResponseHandling(){
        if(this.nNaN>0 && !this.noResponseHandlingSet){

            // Check for person deletion
            // Check whether any person has offered no responses at all
            // If so - delete person irrespective of replacementOption choice
            this.nDeletedPersons = 0;

            for(int j=0;jthis.personDeletionPercentage){
                                this.deletedPersons[i] = true;
                            }
                        }
                    }
                }
            }

            for(int i=0; i0){
                int counter = 0;
                this.deletedPersonsIndices = new int[nDeletedPersons];
                for(int j=0;jthis.itemDeletionPercentage){
                            this.deletedItems[i] = true;
                        }
                    }
                }
            }
            for(int i=0; i0){

                int counter = 0;
                this.deletedItemsIndices = new int[this.nDeletedItems];
                for(int i=0;i0){
                // current item means and total means
                double[] tItemMeans = new double[this.nItems];
                double tTotalMean = 0.0;
                int counter2 = 0;
                for(int i=0; i64 && elem<91 && holdingArrayS[i][j].length()==1){
                            holdingArrayS[i][j] = "" + ((int)elem - 63);
                        }
                        else{
                            if((int)elem>96 && elem<123 && holdingArrayS[i][j].length()==1){
                                holdingArrayS[i][j] = "" + ((int)elem - 96);
                            }
                        }
                    }
                }
                this.letterToNumeralSet = false;
            }


            // Identify 'no responses' (->NaN)and convert all to double[][]
            switch(this.originalDataType){
                case 1:
                case 6: for(int i=0; imaxPrec)maxPrec = prec0;
                }
            }
            if(maxPrec>this.trunc && !this.truncAll)this.trunc = maxPrec;

            // assign original scores to instance variable
            this.originalScores0 = Conv.copy(scores0);
            this.originalScores1 = this.transpose0to1(scores0);
            this.originalNitems = this.nItems;
            this.originalNpersons = this.nPersons;
            this.originalNscores = this.originalNitems*this.originalNpersons;

            // Handle no responses
            // Check for and carry out item deletion
            // check for and carry out no response replacement
            if(this.nNaN>0){
                this.noResponseHandling();
                this.scores1 = this.transpose0to1(this.scores0);
            }


            // Create row - column transposed matrix
            this.scores1 = new double[this.nPersons][this.nItems];
            for(int i=0; ithis.nItems)throw new IllegalArgumentException("Item name, " + itemName + ", is not present in the list of entered item names");
            }
        }
        return index+1;
    }

    //  Get item name for a given index
    public String itemName(int index){
        if(!this.dataEntered)throw new IllegalArgumentException("no data has been entered");
        return this.itemNames[index-1];
    }


    // SUMS, MEANS, VARIANCES, STANDARD DEVIATION, MEDIANS, MAXIMA AND MINIMA
    // Calculate item and person sums, means, variances, standard deviations, mimima and maxima
    // plus same for total responses
    protected void meansAndVariances(){

        // ITEMS
        this.rawItemMeans = new double[this.nItems];
        this.rawItemMedians = new double[this.nItems];
        this.rawItemStandardDeviations = new double[this.nItems];
        this.rawItemVariances = new double[this.nItems];
        this.rawItemMinima = new double[this.nItems];
        this.rawItemMaxima = new double[this.nItems];
        this.rawItemRanges = new double[this.nItems];
        this.rawItemTotals = new double[this.nItems];
        this.rawItemMomentSkewness = new double[this.nItems];
        this.rawItemMedianSkewness = new double[this.nItems];
        this.rawItemQuartileSkewness = new double[this.nItems];
        this.rawItemKurtosisExcess = new double[this.nItems];

        for(int i=0; ithis.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMeans[index-1];
    }

    // Get mean of the raw data item means
    public double rawMeanOfItemMeans(){
        return rawItemMeansMean;
    }

    // Get standard deviation of the raw data item means
    public double rawStandardDeviationOfItemMeans(){
        return rawItemMeansSd;
    }


    // Get variance of the raw data item means
    public double rawVarianceOfItemMeans(){
        return rawItemMeansVar;
    }

    // Get maximum of the raw data item means
    public double rawMaximumOfItemMeans(){
        return rawItemMeansMax;
    }

    // Get minimum of the raw data item means
    public double rawMinimumOfItemMeans(){
        return rawItemMeansMin;
    }

    // Get range of the raw data item means
    public double rawRangeOfItemMeans(){
        return rawItemMeansRange;
    }

    // Get a standardized data item mean
    public double standardizedItemMean(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMeans[index-1];
    }

    public double standardisedItemMean(String itemName){
        return this.standardizedItemMean(itemName);
    }

    // Get a standardized data item mean
    public double standardizedItemMean(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMeans[index-1];
    }

    public double standardisedItemMean(int index){
        return this.standardizedItemMean(index);
    }

    // Get mean of the standardized data item means
    public double standardizedMeanOfItemMeans(){
        return standardizedItemMeansMean;
    }

    public double standardisedMeanOfItemMeans(){
        return standardizedItemMeansMean;
    }

    // Get standard deviation of the standardized data item means
    public double standardizedStanadarDeviationOfItemMeans(){
        return standardizedItemMeansSd;
    }

    public double standardisedStanadarDeviationOfItemMeans(){
        return standardizedItemMeansSd;
    }

    // Get variance of the standardized data item means
    public double standardizedVarianceOfItemMeans(){
        return standardizedItemMeansVar;
    }

    // Get maximum of the standardized data item means
    public double standardizedMaximumOfItemMeans(){
        return standardizedItemMeansMax;
    }

    public double standardisedVarianceOfItemMeans(){
        return standardizedItemMeansVar;
    }

    // Get minimum of the standardized data item means
    public double standardizedMinimumOfItemMeans(){
        return standardizedItemMeansMin;
    }

    public double standardisedMinimumOfItemMeans(){
        return standardizedItemMeansMin;
    }

    // Get range of the standardized data item means
    public double standardizedRangeOfItemMeans(){
        return standardizedItemMeansRange;
    }

    public double standardisedRangeOfItemMeans(){
        return standardizedItemMeansRange;
    }

    // Get raw data item standard deviations
    public double[] rawItemStandardDeviations(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemStandardDeviations;
    }

    // Get a raw data item standard deviation
    public double rawItemStandardDeviation(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemStandardDeviations[index-1];
    }

    // Get a raw data item standard deviation
    public double rawItemStandardDeviation(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemStandardDeviations[index-1];
    }

    // Get mean of the raw data item standard deviation
    public double rawMeanOfItemStandardDeviations(){
        return rawItemStandardDeviationsMean;
    }

    // Get standard deviation of the raw data item standard deviations
    public double rawStanadarDeviationOfItemStandardDeviations(){
        return rawItemStandardDeviationsSd;
    }

    // Get variance of the raw data item standard deviations
    public double rawVarianceOfItemStandardDeviations(){
        return rawItemStandardDeviationsVar;
    }

    // Get maximum of the raw data item standard deviations
    public double rawMaximumOfItemStandardDeviations(){
        return rawItemStandardDeviationsMax;
    }

    // Get minimum of the raw data item standard deviations
    public double rawMinimumOfItemStandardDeviations(){
        return rawItemStandardDeviationsMin;
    }

    // Get range of the raw data item standard deviations
    public double rawRangeOfItemStandardDeviations(){
        return rawItemStandardDeviationsRange;
    }

    // Get standardized data item standard deviations
    public double[] standardizedItemStandardDeviations(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemStandardDeviations;
    }

    public double[] standardisedItemStandardDeviations(){
        return this.standardizedItemStandardDeviations();
    }

    // Get a standardized data item standard deviation
    public double standardizedItemStandardDeviation(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemStandardDeviations[index-1];
    }

    public double standardisedItemStandardDeviation(String itemName){
        return this.standardizedItemStandardDeviation(itemName);
    }

    // Get a standardized data item standard deviation
    public double standardizedItemStandardDeviation(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemStandardDeviations[index-1];
    }

    public double standardisedItemStandardDeviation(int index){
        return this.standardizedItemStandardDeviation(index);
    }

    // Get mean of the standardized data item standard deviations
    public double standardizedMeanOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsMean;
    }

    public double standardisedMeanOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsMean;
    }

    // Get standard deviation of the standardized data item standard deviations
    public double standardizedStanadarDeviationOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsSd;
    }

    public double standardisedStanadarDeviationOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsSd;
    }

    // Get variance of the standardized data item standard deviations
    public double standardizedVarianceOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsVar;
    }

    public double standardisedVarianceOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsVar;
    }

    // Get maximum of the standardized data item standard deviations
    public double standardizedMaximumOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsMax;
    }

    public double standardisedMaximumOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsMax;
    }

    // Get minimum of the standardized data item standard deviations
    public double standardizedMinimumOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsMin;
    }

    public double standardisedMinimumOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsMin;
    }

    // Get range of the standardized data item standard deviations
    public double standardizedRangeOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsRange;
    }

    public double standardisedRangeOfItemStandardDeviations(){
        return standardizedItemStandardDeviationsRange;
    }

    // Get raw data item variances
    public double[] rawItemVariances(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemVariances;
    }

    // Get standardized data item variances
    public double[] standardizedItemVariances(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemVariances;
    }

    // Get standardized data item variances
    public double[] standardisedItemVariances(){
        return this.standardizedItemVariances();
    }

    // Get a raw data item variance
    public double rawItemVariance(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemVariances[index-1];
    }

    // Get a raw data item variance
    public double rawItemVariance(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemVariances[index-1];
    }

    // Get a standardized data item variance
    public double standardizedItemVariance(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemVariances[index-1];
    }

    public double standardisedItemVariance(String itemName){
        return this.standardizedItemVariance(itemName);
    }

    // Get a standardized data item variance
    public double standardizedItemVariance(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemVariances[index-1];
    }

    public double standardisedItemVariance(int index){
        return this.standardizedItemVariance(index);
    }

    // Get mean of the raw data item variances
    public double rawMeanOfItemVariances(){
        return rawItemVariancesMean;
    }

    // Get standard deviation of the raw data item variances
    public double rawStanadarDeviationOfItemVariances(){
        return rawItemVariancesSd;
    }

    // Get variance of the raw data item variances
    public double rawVarianceOfItemVariances(){
        return rawItemVariancesVar;
    }

    // Get maximum of the raw data item variances
    public double rawMaximumOfItemVariances(){
        return rawItemVariancesMax;
    }

    // Get minimum of the raw data item variances
    public double rawMinimumOfItemVariances(){
        return rawItemVariancesMin;
    }

    // Get range of the raw data item variances
    public double rawRangeOfItemVariances(){
        return rawItemVariancesRange;
    }

    // Get mean of the standardized data item variances
    public double standardizedMeanOfItemVariances(){
        return standardizedItemVariancesMean;
    }

    public double standardisedMeanOfItemVariances(){
        return standardizedItemVariancesMean;
    }

    // Get standard deviation of the standardized data item variances
    public double standardizedStanadarDeviationOfItemVariances(){
        return standardizedItemVariancesSd;
    }

    public double standardisedStanadarDeviationOfItemVariances(){
        return standardizedItemVariancesSd;
    }

    // Get variance of the standardized data item variances
    public double standardizedVarianceOfItemVariances(){
        return standardizedItemVariancesVar;
    }

    public double standardisedVarianceOfItemVariances(){
        return standardizedItemVariancesVar;
    }

    // Get maximum of the standardized data item variances
    public double standardizedMaximumOfItemVariances(){
        return standardizedItemVariancesMax;
    }

    public double standardisedMaximumOfItemVariances(){
        return standardizedItemVariancesMax;
    }

    // Get minimum of the standardized data item variances
    public double standardizedMinimumOfItemVariances(){
        return standardizedItemVariancesMin;
    }

    public double standardisedMinimumOfItemVariances(){
        return standardizedItemVariancesMin;
    }

    // Get range of the standardized data item variances
    public double standardizedRangeOfItemVariances(){
        return standardizedItemVariancesRange;
    }

    public double standardisedRangeOfItemVariances(){
        return standardizedItemVariancesRange;
    }

    // Get raw data item minima
    public double[] rawItemMinima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMinima;
    }

    // Get standardized data item minima
    public double[] standardizedItemMinima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMinima;
    }

    public double[] standardisedItemMinima(){
        return this.standardizedItemMinima();
    }

    // Get a raw data item minimum
    public double rawItemMinimum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMinima[index-1];
    }

    // Get a standardized data item minimum
    public double standardizedItemMinimum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMinima[index-1];
    }

    public double standardisedItemMinimum(int index){
        return this.standardizedItemMinimum(index);
    }

    // Get mean of the raw data item minima
    public double rawMeanOfItemMinima(){
        return rawItemMinimaMean;
    }

    // Get standard deviation of the raw data item minima
    public double rawStanadarDeviationOfItemMinima(){
        return rawItemMinimaSd;
    }

    // Get variance of the raw data item minima
    public double rawVarianceOfItemMinima(){
        return rawItemMinimaVar;
    }

    // Get maximum of the raw data item minima
    public double rawMaximumOfItemMinima(){
        return rawItemMinimaMax;
    }

    // Get minimum of the raw data item minima
    public double rawMinimumOfItemMinima(){
        return rawItemMinimaMin;
    }

    // Get range of the raw data item minima
    public double rawRangeOfItemMinima(){
        return rawItemMinimaRange;
    }

   // Get mean of the standardized data item minima
    public double standardizedMeanOfItemMinima(){
        return standardizedItemMinimaMean;
    }

    public double standardisedMeanOfItemMinima(){
        return standardizedItemMinimaMean;
    }

    // Get standard deviation of the standardized data item minima
    public double standardizedStanadarDeviationOfItemMinima(){
        return standardizedItemMinimaSd;
    }

    public double standardisedStanadarDeviationOfItemMinima(){
        return standardizedItemMinimaSd;
    }

    // Get variance of the standardized data item minima
    public double standardizedVarianceOfItemMinima(){
        return standardizedItemMinimaVar;
    }

    public double standardisedVarianceOfItemMinima(){
        return standardizedItemMinimaVar;
    }

    // Get maximum of the standardized data item minima
    public double standardizedMaximumOfItemMinima(){
        return standardizedItemMinimaMax;
    }

    public double standardisedMaximumOfItemMinima(){
        return standardizedItemMinimaMax;
    }

    // Get minimum of the standardized data item minima
    public double standardizedMinimumOfItemMinima(){
        return standardizedItemMinimaMin;
    }

    public double standardisedMinimumOfItemMinima(){
        return standardizedItemMinimaMin;
    }

    // Get range of the standardized data item minima
    public double standardizedRangeOfItemMinima(){
        return standardizedItemMinimaRange;
    }

    public double standardisedRangeOfItemMinima(){
        return standardizedItemMinimaRange;
    }

    // Get raw data item maxima
    public double[] rawItemMaxima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMaxima;
    }

    // Get standardized data item maxima
    public double[] standardizedItemMaxima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMaxima;
    }

    public double[] standardisedItemMaxima(){
        return this.standardizedItemMaxima();
    }

    // Get a raw data item maximum
    public double rawItemMaximum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMaxima[index-1];
    }

    // Get a standardized data item maximum
    public double standardizedItemMaximum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMaxima[index-1];
    }

    public double standardisedItemMaximum(int index){
         return this.standardizedItemMaximum(index);
    }

    // Get mean of the raw data item maxima
    public double rawMeanOfItemMaxima(){
        return rawItemMaximaMean;
    }

    // Get standard deviation of the raw data item maxima
    public double rawStanadarDeviationOfItemMaxima(){
        return rawItemMaximaSd;
    }

    // Get variance of the raw data item maxima
    public double rawVarianceOfItemMaxima(){
        return rawItemMaximaVar;
    }

    // Get maximum of the raw data item maxima
    public double rawMaximumOfItemMaxima(){
        return rawItemMaximaMax;
    }

    // Get minimum of the raw data item maxima
    public double rawMinimumOfItemMaxima(){
        return rawItemMaximaMin;
    }

    // Get range of the raw data item maxima
    public double rawRangeOfItemMaxima(){
        return rawItemMaximaRange;
    }

    // Get mean of the standardized data item maxima
    public double standardizedMeanOfItemMaxima(){
        return standardizedItemMaximaMean;
    }

    public double standardisedMeanOfItemMaxima(){
        return standardizedItemMaximaMean;
    }

    // Get standard deviation of the standardized data item maxima
    public double standardizedStanadarDeviationOfItemMaxima(){
        return standardizedItemMaximaSd;
    }

    public double standardisedStanadarDeviationOfItemMaxima(){
        return standardizedItemMaximaSd;
    }

    // Get variance of the standardized data item maxima
    public double standardizedVarianceOfItemMaxima(){
        return standardizedItemMaximaVar;
    }

    public double standardisedVarianceOfItemMaxima(){
        return standardizedItemMaximaVar;
    }

    // Get maximum of the standardized data item maxima
    public double standardizedMaximumOfItemMaxima(){
        return standardizedItemMaximaMax;
    }

    public double standardisedMaximumOfItemMaxima(){
        return standardizedItemMaximaMax;
    }

    // Get minimum of the standardized data item maxima
    public double standardizedMinimumOfItemMaxima(){
        return standardizedItemMaximaMin;
    }

    public double standardisedMinimumOfItemMaxima(){
        return standardizedItemMaximaMin;
    }

    // Get range of the standardized data item maxima
    public double standardizedRangeOfItemMaxima(){
        return standardizedItemMaximaRange;
    }

    public double standardisedRangeOfItemMaxima(){
        return standardizedItemMaximaRange;
    }

    // Get raw data item ranges
    public double[] rawItemRanges(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemRanges;
    }

    // Get standardized data item ranges
    public double[] standardizedItemRanges(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemRanges;
    }

    public double[] standardisedItemRanges(){
        return standardizedItemRanges();
    }

    // Get a raw data item range
    public double rawItemRange(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemRanges[index-1];
    }

    // Get a standardized data item range
    public double standardizedItemRange(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemRanges[index-1];
    }

    public double standardisedItemRange(int index){
        return this.standardizedItemRange(index);
    }

    // Get mean of the raw data item ranges
    public double rawMeanOfItemRanges(){
        return rawItemRangesMean;
    }

    // Get standard deviation of the raw data item ranges
    public double rawStanadarDeviationOfItemRanges(){
        return rawItemRangesSd;
    }

    // Get variance of the raw data item ranges
    public double rawVarianceOfItemRanges(){
        return rawItemRangesVar;
    }

    // Get maximum of the raw data item ranges
    public double rawMaximumOfItemRanges(){
        return rawItemRangesMax;
    }

    // Get minimum of the raw data item ranges
    public double rawMinimumOfItemRanges(){
        return rawItemRangesMin;
    }

    // Get range of the raw data item ranges
    public double rawRangeOfItemRanges(){
        return rawItemRangesRange;
    }

    // Get mean of the standardized data item ranges
    public double standardizedMeanOfItemRanges(){
        return standardizedItemRangesMean;
    }

    public double standardisedMeanOfItemRanges(){
        return standardizedItemRangesMean;
    }

    // Get standard deviation of the standardized data item ranges
    public double standardizedStanadarDeviationOfItemRanges(){
        return standardizedItemRangesSd;
    }

    public double standardisedStanadarDeviationOfItemRanges(){
        return standardizedItemRangesSd;
    }

    // Get variance of the standardized data item ranges
    public double standardizedVarianceOfItemRanges(){
        return standardizedItemRangesVar;
    }

    public double standardisedVarianceOfItemRanges(){
        return standardizedItemRangesVar;
    }

    // Get maximum of the standardized data item ranges
    public double standardizedMaximumOfItemRanges(){
        return standardizedItemRangesMax;
    }

    public double standardisedMaximumOfItemRanges(){
        return standardizedItemRangesMax;
    }

    // Get minimum of the standardized data item ranges
    public double standardizedMinimumOfItemRanges(){
        return standardizedItemRangesMin;
    }

    public double standardisedMinimumOfItemRanges(){
        return standardizedItemRangesMin;
    }

    // Get range of the standardized data item ranges
    public double standardizedRangeOfItemRanges(){
        return standardizedItemRangesRange;
    }

    public double standardisedRangeOfItemRanges(){
        return standardizedItemRangesRange;
    }

    // Get raw data item totals
    public double[] rawItemTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemTotals;
    }

    // Get standardized data item totals
    public double[] standardizedItemTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemTotals;
    }

    public double[] standardisedItemTotals(){
        return this.standardizedItemTotals();
    }

    // Get a raw data item total
    public double rawItemTotal(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemTotals[index-1];
    }

    // Get a raw data item total
    public double rawItemTotal(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemTotals[index-1];
    }

    // Get a standardized data item total
    public double standardizedItemTotal(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemTotals[index-1];
    }

    public double standardisedItemTotal(String itemName){
       return standardizedItemTotal(itemName);
    }

    // Get a standardized data item total
    public double standardizedItemTotal(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemTotals[index-1];
    }

    public double standardisedItemTotal(int index){
        return this.standardizedItemTotal(index);
    }

    // Get mean of the raw data item totals
    public double rawMeanOfItemTotals(){
        return rawItemTotalsMean;
    }

    // Get standard deviation of the raw data item totals
    public double rawStanadarDeviationOfItemTotals(){
        return rawItemTotalsSd;
    }

    // Get variance of the raw data item totals
    public double rawVarianceOfItemTotals(){
        return rawItemTotalsVar;
    }

    // Get maximum of the raw data item totals
    public double rawMaximumOfItemTotals(){
        return rawItemTotalsMax;
    }

    // Get minimum of the raw data item totals
    public double rawMinimumOfItemTotals(){
        return rawItemTotalsMin;
    }

    // Get range of the raw data item totals
    public double rawRangeOfItemTotals(){
        return rawItemTotalsRange;
    }

    // Get mean of the standardized data item totals
    public double standardizedMeanOfItemTotals(){
        return standardizedItemTotalsMean;
    }

    public double standardisedMeanOfItemTotals(){
        return standardizedItemTotalsMean;
    }

    // Get standard deviation of the standardized data item totals
    public double standardizedStanadarDeviationOfItemTotals(){
        return standardizedItemTotalsSd;
    }

    public double standardisedStanadarDeviationOfItemTotals(){
        return standardizedItemTotalsSd;
    }

    // Get variance of the standardized data item totals
    public double standardizedVarianceOfItemTotals(){
        return standardizedItemTotalsVar;
    }

    public double standardisedVarianceOfItemTotals(){
        return standardizedItemTotalsVar;
    }

    // Get maximum of the standardized data item totals
    public double standardizedMaximumOfItemTotals(){
        return standardizedItemTotalsMax;
    }

    public double standardisedMaximumOfItemTotals(){
        return standardizedItemTotalsMax;
    }

    // Get minimum of the standardized data item totals
    public double standardizedMinimumOfItemTotals(){
        return standardizedItemTotalsMin;
    }

    public double standardisedMinimumOfItemTotals(){
        return standardizedItemTotalsMin;
    }

    // Get range of the standardized data item totals
    public double standardizedRangeOfItemTotals(){
        return standardizedItemTotalsRange;
    }

    public double standardisedRangeOfItemTotals(){
        return standardizedItemTotalsRange;
    }

    // Get raw data person means
    public double[] rawPersonMeans(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonMeans;
    }

    // Get standardized data person means
    public double[] standardizedPersonMeans(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonMeans;
    }

    public double[] standardisedPersonMeans(){
        return this.standardizedPersonMeans();
    }

    // Get a raw data person mean
    public double rawPersonMean(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonMeans[index-1];
    }

    // Get a standardized data person mean
    public double standardizedPersonMean(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonMeans[index-1];
    }

    public double standardisedPersonMean(int index){
        return this.standardizedPersonMean(index);
    }

    // Get raw data person standard deviations
    public double[] rawPersonStandardDeviations(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonStandardDeviations;
    }

    // Get standardized data person standard deviations
    public double[] standardizedPersonStandardDeviations(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonStandardDeviations;
    }

    public double[] standardisedPersonStandardDeviations(){
        return this.standardizedPersonStandardDeviations();
    }

    // Get a raw data person standard deviation
    public double rawPersonStandardDeviation(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonStandardDeviations[index-1];
    }

    // Get a standardized data person standard deviation
    public double standardizedPersonStandardDeviation(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonStandardDeviations[index-1];
    }

     public double standardisedPersonStandardDeviation(int index){
        return this.standardizedPersonStandardDeviation(index);
    }

    // Get raw data person variances
    public double[] rawPersonVariances(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonVariances;
    }

    // Get standardized data person variances
    public double[] standardizedPersonVariances(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonVariances;
    }

    public double[] standardisedPersonVariances(){
        return this.standardizedPersonVariances();
    }

    // Get a raw data person variance
    public double rawPersonVariance(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonVariances[index-1];
    }

    // Get a standardized data person variance
    public double standardizedPersonVariance(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonVariances[index-1];
    }

    public double standardisedPersonVariance(int index){
        return this.standardizedPersonVariance(index);
    }

    // Get raw data person minima
    public double[] rawPersonMinima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonMinima;
    }

    // Get standardized data person minima
    public double[] standardizedPersonMinima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonMinima;
    }

    public double[] standardisedPersonMinima(){
       return this.standardisedPersonMinima();
    }

    // Get a raw data person minimum
    public double rawPersonMinimum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonMinima[index-1];
    }

    // Get a standardized data person minimum
    public double standardizedPersonMinimum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonMinima[index-1];
    }

    public double standardisedPersonMinimum(int index){
        return this.standardizedPersonMinimum(index);
    }

    // Get raw data person maxima
    public double[] rawPersonMaxima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonMaxima;
    }

    // Get standardized data person maxima
    public double[] standardizedPersonMaxima(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonMaxima;
    }

    public double[] standardisedPersonMaxima(){
        return this.standardizedPersonMaxima();
    }

    // Get a raw data person maximum
    public double rawPersonMaximum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonMaxima[index-1];
    }

    // Get a standardized data person maximum
    public double standardizedPersonMaximum(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonMaxima[index-1];
    }

    public double standardisedPersonMaximum(int index){
        return this.standardizedPersonMaximum(index);
    }

    // Get raw data person ranges
    public double[] rawPersonRanges(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonRanges;
    }

    // Get standardized data person ranges
    public double[] standardizedPersonRanges(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonRanges;
    }

    public double[] standardisedPersonRanges(){
        return this.standardizedPersonRanges();
    }

    // Get a raw data person range
    public double rawPersonRange(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonRanges[index-1];
    }

    // Get a standardized data person range
    public double standardizedPersonRange(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonRanges[index-1];
    }

    public double standardisedPersonRange(int index){
        return this.standardizedPersonRange(index);
    }

    // Get raw data item medians
    public double[] rawItemMedians(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMedians;
    }

    // Get standardized data item medians
    public double[] standardizedItemMedians(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMedians;
    }

    public double[] standardisedItemMedians(){
        return this.standardizedItemMedians();
    }

    // Get a raw data item median
    public double rawItemMedian(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMedians[index-1];
    }

    // Get a raw data item median
    public double rawItemMedian(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawItemMedians[index-1];
    }

    // Get a standardized data item median
    public double standardizedItemMedian(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        int index = this.itemIndex(itemName);
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMedians[index-1];
    }

    public double standardisedItemMedian(String itemName){
       return standardizedItemMedian(itemName);
    }

    // Get a standardized data item median
    public double standardizedItemMedian(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedItemMedians[index-1];
    }

    public double standardisedItemMedian(int index){
        return this.standardizedItemMedian(index);
    }

    // Get mean of the raw data item medians
    public double rawMeanOfItemMedians(){
        return rawItemMediansMean;
    }

    // Get standard deviation of the raw data item medians
    public double rawStanadarDeviationOfItemMedians(){
        return rawItemMediansSd;
    }

    // Get variance of the raw data item medians
    public double rawVarianceOfItemMedians(){
        return rawItemMediansVar;
    }

    // Get maximum of the raw data item medians
    public double rawMaximumOfItemMedians(){
        return rawItemMediansMax;
    }

    // Get minimum of the raw data item medians
    public double rawMinimumOfItemMedians(){
        return rawItemMediansMin;
    }

    // Get range of the raw data item medians
    public double rawRangeOfItemMedians(){
        return rawItemMediansRange;
    }

    // Get mean of the standardized data item medians
    public double standardizedMeanOfItemMedians(){
        return standardizedItemMediansMean;
    }

    public double standardisedMeanOfItemMedians(){
        return standardizedItemMediansMean;
    }

    // Get standard deviation of the standardized data item medians
    public double standardizedStanadarDeviationOfItemMedians(){
        return standardizedItemMediansSd;
    }

    public double standardisedStanadarDeviationOfItemMedians(){
        return standardizedItemMediansSd;
    }

    // Get variance of the standardized data item medians
    public double standardizedVarianceOfItemMedians(){
        return standardizedItemMediansVar;
    }

    public double standardisedVarianceOfItemMedians(){
        return standardizedItemMediansVar;
    }

    // Get maximum of the standardized data item medians
    public double standardizedMaximumOfItemMedians(){
        return standardizedItemMediansMax;
    }

    public double standardisedMaximumOfItemMedians(){
        return standardizedItemMediansMax;
    }

    // Get minimum of the standardized data item medians
    public double standardizedMinimumOfItemMedians(){
        return standardizedItemMediansMin;
    }

    public double standardisedMinimumOfItemMedians(){
        return standardizedItemMediansMin;
    }

    // Get range of the standardized data item medians
    public double standardizedRangeOfItemMedians(){
        return standardizedItemMediansRange;
    }

    public double standardisedRangeOfItemMedians(){
        return standardizedItemMediansRange;
    }

    // Get raw data person totals
    public double[] rawPersonTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonTotals;
    }

    // Get standardized data person totals
    public double[] standardizedPersonTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonTotals;
    }

    public double[] standardisedPersonTotals(){
        return this.standardizedPersonTotals();
    }

    // Get a raw data person total
    public double rawPersonTotal(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawPersonTotals[index-1];
    }

    // Get a standardized data person total
    public double standardizedPersonTotal(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nPersons)throw new IllegalArgumentException("The person index, " + index + ", must lie between 1 and the number of persons," + this.nPersons + ", inclusive");
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedPersonTotals[index-1];
    }

    public double standardisedPersonTotal(int index){
        return this.standardizedPersonTotal(index);
    }

    // Get raw data total mean
    public double rawAllResponsesMean(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesMean;
    }

    // Get standardized data total mean
    public double standardizedAllResponsesMean(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesMean;
    }

    public double standardisedTotalMean(){
        return this.standardizedAllResponsesMean();
    }

    // Get raw data total standard deviation
    public double rawAllResponsesStandardDeviation(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesStandardDeviation;
    }

    // Get standardized data total standard deviation
    public double standardizedAllResponsesStandardDeviation(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesStandardDeviation;
    }

    public double standardisedTotalStandardDeviation(){
        return this.standardizedAllResponsesStandardDeviation();
    }

    // Get raw data total variance
    public double rawAllResponsesVariance(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesVariance;
    }

    // Get standardized data total variance
    public double standardizedAllResponsesVariance(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesVariance;
    }

    public double standardisedTotalVariance(){
        return this.standardizedAllResponsesVariance();
    }

    // Get raw data total minimum
    public double rawAllResponsesMinimum(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesMinimum;
    }

    // Get standardized data total minimum
    public double standardizedAllResponsesMinimum(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesMinimum;
    }

    public double standardisedTotalMinimum(){
        return this.standardizedAllResponsesMinimum();
    }

    // Get raw data total maximum
    public double rawAllResponsesMaximum(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesMaximum;
    }

    // Get standardized data total maximum
    public double standardizedAllResponsesMaximum(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesMaximum;
    }

    public double standardisedTotalMaximum(){
        return this.standardizedAllResponsesMaximum();
    }

    // Get raw data total range
    public double rawAllResponsesRange(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesRange;
    }

    // Get standardized data total range
    public double standardizedAllResponsesRange(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesRange;
    }

    public double standardisedTotalRange(){
        return this.standardizedAllResponsesRange();
    }

    // Get raw data total total
    public double rawAllResponsesTotal(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.rawAllResponsesTotal;
    }

    // Get standardized data total total
    public double standardizedAllResponsesTotal(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.variancesCalculated)this.meansAndVariances();
        return this.standardizedAllResponsesTotal;
    }

    public double standardisedTotalTotal(){
        return this.standardizedAllResponsesTotal();
    }

    // COVARIANCES AND CORRELATION COEFFICIENTS
    // Calculate covariances and correlation coefficints between items
    protected void covariancesAndCorrelationCoefficients(){
        // Covariances
        this.rawCovariances = new double[this.nItems+1][this.nItems+1];
        // raw data item-item covariance
        for(int i=0; ithis.nItems)throw new IllegalArgumentException("The first item index, " + index1 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(index2<1 || index2>this.nItems)throw new IllegalArgumentException("The second item index, " + index2 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawCovariances[index1-1][index2-1];
    }

    // Get the raw data covariance of an item and the toals of the items
    public double rawCovariance(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index = this.itemIndex(itemName);
        return this.rawCovariances[index-1][this.nItems];
    }

    // Get the raw data covariance of an item and the toals of the items
    public double rawCovariance(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index< 1 || index>this.nItems)throw new IllegalArgumentException("The first item index, " + index + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawCovariances[index-1][this.nItems];
    }

    // Get the standardized data covariance of two items
    public double standardizedCovariance(String itemName1, String itemName2){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index1 = this.itemIndex(itemName1);
        int index2 = this.itemIndex(itemName2);
        return this.standardizedCovariances[index1+1][index2+1];
    }

    public double standardisedCovariance(String itemName1, String itemName2){
        return this.standardizedCovariance(itemName1, itemName2);
    }

    // Get the standardized data covariance of two items
    public double standardizedCovariance(int index1, int index2){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index1<1 || index1>this.nItems)throw new IllegalArgumentException("The first item index, " + index1 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(index2<1 || index2>this.nItems)throw new IllegalArgumentException("The second item index, " + index2 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedCovariances[index1+1][index2+1];
    }

    public double standardisedCovariance(int index1, int index2){
        return this.standardizedCovariance(index1, index2);
    }

    // Get the standardized data covariance of an item and the toals of the items
    public double standardizedCovariance(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index = this.itemIndex(itemName);
        return this.standardizedCovariances[index+1][this.nItems];
    }

    public double standardisedCovariance(String itemName){
        return this.standardizedCovariance(itemName);
    }

    // Get the standardized data covariance of an item and the totals of the items
    public double standardizedCovariance(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The first item index, " + index + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedCovariances[index+1][this.nItems];
    }

    public double standardisedCovariance(int index){
        return this.standardizedCovariance(index);
    }

    // Get the raw data average correlation coefficient excluding totals
    public double rawAverageCorrelationCoefficients(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawMeanRhoWithoutTotals;
    }

    // Get the raw data standardard deviation of the correlation coefficient excluding totals
    public double rawStandardDeviationCorrelationCoefficients(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawStandardDeviationRhoWithoutTotals;
    }

    // Get the standardized data average correlation coefficient excluding totals
    public double standardizedAverageCorrelationCoefficients(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedMeanRhoWithoutTotals;
    }

    public double standardisedAverageCorrelationCoefficients(){
        return this.standardizedAverageCorrelationCoefficients();
    }

    // Get the standardized data standardard deviation of the correlation coefficient excluding totals
    public double standardizedStandardDeviationCorrelationCoefficients(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedStandardDeviationRhoWithoutTotals;
    }

    public double standardisedStandardDeviationCorrelationCoefficients(){
        return this.standardizedStandardDeviationCorrelationCoefficients();
    }

    // Get the raw data average correlation coefficient including totals
    public double rawAverageCorrelationCoefficientsWithTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawMeanRhoWithTotals;
    }

    // Get the raw data standardard deviation of the correlation coefficient including totals
    public double rawStandardDeviationCorrelationCoefficientsWithTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawStandardDeviationRhoWithTotals;
    }

    // Get the standardized data average correlation coefficient including totals
    public double standardizedAverageCorrelationCoefficientsWithTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedMeanRhoWithTotals;
    }

    public double standardisedAverageCorrelationCoefficientsWithTotals(){
        return this.standardizedAverageCorrelationCoefficientsWithTotals();
    }

    // Get the standardized data standardard deviation of the correlation coefficient including totals
    public double standardizedStandardDeviationCorrelationCoefficientsWithTotals(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedStandardDeviationRhoWithTotals;
    }

    public double standardisedStandardDeviationCorrelationCoefficientsWithTotals(){
        return this.standardizedStandardDeviationCorrelationCoefficientsWithTotals();
    }

    // Get the raw data correlation coefficients
    public double[][] rawCorrelationCoefficients(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawCorrelationCoefficients;
    }


    // Get the standardized data correlation coefficients
    public double[][] standardizedCorrelationCoefficients(){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedCorrelationCoefficients;
    }

    public double[][] standardisedCorrelationCoefficients(){
        return this.standardizedCorrelationCoefficients();
    }

    // Get the raw data correlation coefficient of two items
    public double rawCorrelationCoefficient(String itemName1, String itemName2){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index1 = this.itemIndex(itemName1);
        int index2 = this.itemIndex(itemName2);
        return this.rawCorrelationCoefficients[index1-1][index2-1];
    }

    // Get the raw data correlation coefficient of two items
    public double rawCorrelationCoefficient(int index1, int index2){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index1<1 || index1>this.nItems)throw new IllegalArgumentException("The first item index, " + index1 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(index2<1 || index2>this.nItems)throw new IllegalArgumentException("The second item index, " + index2 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawCorrelationCoefficients[index1-1][index2-1];
    }

        // Get the raw data correlation coefficient of an item and the totals of the items`
    public double rawCorrelationCoefficient(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index = this.itemIndex(itemName);
        return this.rawCorrelationCoefficients[index-1][this.nItems];
    }

    // Get the raw data correlation coefficient of an item and the totals of the items`
    public double rawCorrelationCoefficient(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The first item index, " + index + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.rawCorrelationCoefficients[index-1][this.nItems];
    }

    // Get the standardized data correlation coefficient of two items
    public double standardizedCorrelationCoefficient(String itemName1, String itemName2){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index1 = this.itemIndex(itemName1);
        int index2 = this.itemIndex(itemName2);
        return this.standardizedCorrelationCoefficients[index1+1][index2+1];
    }

    public double standardisedCorrelationCoefficient(String itemName1, String itemName2){
        return this.standardizedCorrelationCoefficient(itemName1, itemName2);
    }

    // Get the standardized data correlation coefficient of two items
    public double standardizedCorrelationCoefficient(int index1, int index2){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index1<1 || index1>this.nItems)throw new IllegalArgumentException("The first item index, " + index1 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(index2<1 || index2>this.nItems)throw new IllegalArgumentException("The second item index, " + index2 + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedCorrelationCoefficients[index1+1][index2+1];
    }

    public double standardisedCorrelationCoefficient(int index1, int index2){
        return this.standardizedCorrelationCoefficient(index1, index2);
    }

    // Get the standardized data correlation coefficient of an item and the totals of the items`
    public double standardizedCorrelationCoefficient(String itemName){
        if(!this.dataPreprocessed)this.preprocessData();
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        int index = this.itemIndex(itemName);
        return this.standardizedCorrelationCoefficients[index+1][this.nItems];
    }

    public double standardisedCorrelationCoefficient(String itemName){
        return this.standardizedCorrelationCoefficient(itemName);
    }

    // Get the standardized data correlation coefficient of an item and the totals of the items`
    public double standardizedCorrelationCoefficient(int index){
        if(!this.dataPreprocessed)this.preprocessData();
        if(index<1 || index>this.nItems)throw new IllegalArgumentException("The first item index, " + index + ", must lie between 1 and the number of items plus one (for totals)," + (this.nItems+1) + ", inclusive");
        if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
        return this.standardizedCorrelationCoefficients[index+1][this.nItems];
    }

    public double standardisedCorrelationCoefficient(int index){
        return this.standardizedCorrelationCoefficient(index);
    }


    // Check which of the original items are dichotomous
    protected double[] checkWhetherRawItemsDichotomous(){

        if(!this.dichotomousCheckDone){
            this.dichotomous = new boolean[this.nItems];
            this.dichotomousPercentage = new double[this.nItems];
            int nDich = 0;
            for(int k=0; k 

Ads help maintain this website.