public static void schmiedeckEtAlScript(boolean useDetrend, boolean useFirstFactor, boolean useTaskCombination, boolean ignoreBetweenInMDS) { // Setting constants and reserving memory space String betweenDataName = "between"; String withinDataName = "raw_person"; int anzPerFull = 101, anzVar = 18, corSize = (useFirstFactor || useTaskCombination?9:18); double[] avgPersonCorWthn = new double[anzPerFull+1]; Statik.setTo(avgPersonCorWthn, -999.0); double[] avgPersonCorBtw = new double[anzPerFull+1]; Statik.setTo(avgPersonCorBtw, -999.0); double[] highestEValCorWthn = new double[anzPerFull+1]; Statik.setTo(highestEValCorWthn, -999.0); double[] highestEValCorBtwn = new double[anzPerFull+1]; Statik.setTo(highestEValCorBtwn, -999.0); double[] highestEValCorSmooth = new double[anzPerFull+1]; Statik.setTo(highestEValCorBtwn, -999.0); double[][] highestEVecCorWthn = new double[anzPerFull+1][corSize]; Statik.setTo(highestEVecCorWthn, -999.0); double[][] highestEVecCorBtwn = new double[anzPerFull+1][corSize]; Statik.setTo(highestEVecCorBtwn, -999.0); double[][] highestEVecCorSmooth = new double[anzPerFull+1][corSize]; Statik.setTo(highestEVecCorBtwn, -999.0); double[][] flatFactorCoefficient = new double[anzPerFull+1][corSize]; Statik.setTo(flatFactorCoefficient, -999.0); double[][] preferences = Statik.loadMatrix("FloData"+File.separator+"cogito_preferences.dat", '\t'); int[] omit = new int[]{}; int nextOmit = 0; Vector id = new Vector(); Vector corv = new Vector(); double[][] wthnAvgCov = new double[corSize][corSize], btwnAvgCov = new double[corSize][corSize]; double[][][] wthnCorMem = new double[anzPerFull][corSize][corSize]; double[][][] smoothCorMem = new double[anzPerFull][corSize][corSize]; double[][] wthnDataSmoothRaise = new double[anzPerFull][corSize]; double[][] wthnMean = new double[anzPerFull][corSize]; double[][] wthnReducedAvgCov = new double[corSize][corSize], btwnReducedAvgCov = new double[corSize][corSize]; double[][][] pretestData = new double[anzPerFull][][]; double[][] pretestMean = new double[anzPerFull][]; double[][][] pretestCov = new double[anzPerFull][][]; double[][][] combinedData = new double[anzPerFull][][]; double[][] combinedMean = new double[anzPerFull][corSize]; double[][][] combinedWthnCov = new double[anzPerFull][corSize][corSize]; /* * In this loop, the covariance and correlation matrices "within" and "between" are computed * for each participant. The within covariance matrix is based on the participant's longitudinal * data, the between covariance matrix is based on the pretest data for all participants with the * same time settings as the current participant. Depending on the script parameters, the data is either raw or detrended, * and the two indicators for each variable are either left separate or collapsed into one. * Participants can be omitted from the analysis using the omit vector. All participants with numerical errors * are reported to standard output. */ System.out.print("Failed IDs = "); for (int partNr=1; partNr<=anzPerFull; partNr++) if (nextOmit >= omit.length || partNr != omit[nextOmit]) { double[][] wthnDataWithID = Statik.loadMatrix("FloData"+File.separator+withinDataName+"_"+partNr+".dat", ' ', true, "."); int[] allButOne = new int[anzVar]; for (int i=0; i 1000) anzBtw++; double[][][] allBtwCov = new double[anzBtw][][], block1BtwCov = new double[anzBtw][][], block2BtwCov = new double[anzBtw][][], block3BtwCov = new double[anzBtw][][]; int k = 0; for (int i=0; i 1000) {allBtwCov[k] = cor[i]; block1BtwCov[k] = Statik.submatrix(cor[i], new int[]{0,1,2}, new int[]{0,1,2}); block2BtwCov[k] = Statik.submatrix(cor[i], new int[]{3,4,5}, new int[]{3,4,5}); block3BtwCov[k] = Statik.submatrix(cor[i], new int[]{6,7,8}, new int[]{6,7,8}); k++; } int simTrials = 100; System.out.println("********** Starting simulation of null distribution for average KL (within) ************"); floSimulateAverageKLUnderNull(wthnAvgCov, null, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (between) ************"); floSimulateAverageKLUnderNull(btwnAvgCov, allBtwCov, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (PS within) ************"); floSimulateAverageKLUnderNull(Statik.submatrix(wthnAvgCov, new int[]{0,1,2}, new int[]{0,1,2}), null, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (PS between) ************"); floSimulateAverageKLUnderNull(Statik.submatrix(btwnAvgCov, new int[]{0,1,2}, new int[]{0,1,2}), block1BtwCov, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (WM within) ************"); floSimulateAverageKLUnderNull(Statik.submatrix(wthnAvgCov, new int[]{3,4,5}, new int[]{3,4,5}), null, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (WM between) ************"); floSimulateAverageKLUnderNull(Statik.submatrix(btwnAvgCov, new int[]{3,4,5}, new int[]{3,4,5}), block2BtwCov, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (EM within) ************"); floSimulateAverageKLUnderNull(Statik.submatrix(wthnAvgCov, new int[]{6,7,8}, new int[]{6,7,8}), null, simTrials); System.out.println("********** Starting simulation of null distribution for average KL (EM between) ************"); floSimulateAverageKLUnderNull(Statik.submatrix(btwnAvgCov, new int[]{6,7,8}, new int[]{6,7,8}), block3BtwCov, simTrials); floErgodicSubspace(btwnAvgCov, wthnAvgCov); if (!ignoreBetweenInMDS) { System.out.println("Distances of within covariance matrices to between centroid (5% significant greater than 62.70), then distance to corresponding between: "); for (int i=0; i