source: src/main/java/agents/anac/y2015/agentBuyogV2/flanagan/analysis/Cronbach.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 83.1 KB
Line 
1/*
2* CLASS: Cronbach
3*
4* USAGE: Cronbach raw data alpha reliability
5* Cronbach standardized data alpha reliability
6* Correlation between items
7* Deletion of items
8*
9* This is a subclass of the superclass Scores
10*
11*
12* WRITTEN BY: Dr Michael Thomas Flanagan
13*
14* DATE: July and Agust 2008
15* AMENDED: 22 August 2008, 29 August 2008, 1-8 October 2008, 1-4 November 2010
16*
17* DOCUMENTATION:
18* See Michael Thomas Flanagan's Java library on-line web pages:
19* http://www.ee.ucl.ac.uk/~mflanaga/java/
20* http://www.ee.ucl.ac.uk/~mflanaga/java/Cronbach.html
21*
22* Copyright (c) 2008 Michael Thomas Flanagan
23*
24* PERMISSION TO COPY:
25*
26* Permission to use, copy and modify this software and its documentation for NON-COMMERCIAL purposes is granted, without fee,
27* provided that an acknowledgement to the author, Dr Michael Thomas Flanagan at www.ee.ucl.ac.uk/~mflanaga, appears in all copies
28* and associated documentation or publications.
29*
30* 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
31* and the following disclaimer and requires written permission from the Michael Thomas Flanagan:
32*
33* Redistribution in binary form of all or parts of this class must reproduce the above copyright notice, this list of conditions and
34* the following disclaimer in the documentation and/or other materials provided with the distribution and requires written permission from the Michael Thomas Flanagan:
35*
36* Dr Michael Thomas Flanagan makes no representations about the suitability or fitness of the software for any or for a particular purpose.
37* Dr Michael Thomas Flanagan shall not be liable for any damages suffered as a result of using, modifying or distributing this software
38* or its derivatives.
39*
40***************************************************************************************/
41
42
43package agents.anac.y2015.agentBuyogV2.flanagan.analysis;
44
45import java.util.*;
46
47import agents.anac.y2015.agentBuyogV2.flanagan.analysis.Scores;
48import agents.anac.y2015.agentBuyogV2.flanagan.analysis.Stat;
49import agents.anac.y2015.agentBuyogV2.flanagan.io.Db;
50import agents.anac.y2015.agentBuyogV2.flanagan.io.FileOutput;
51import agents.anac.y2015.agentBuyogV2.flanagan.math.ArrayMaths;
52import agents.anac.y2015.agentBuyogV2.flanagan.math.Fmath;
53import agents.anac.y2015.agentBuyogV2.flanagan.plot.Plot;
54import agents.anac.y2015.agentBuyogV2.flanagan.plot.PlotGraph;
55
56import java.text.*;
57
58
59public class Cronbach extends Scores{
60
61 private double rawAlpha = Double.NaN; // Cronbach raw data alpha reliability coefficient
62 private boolean rawAlphaCalculated = false; // = true when raw data alpha reliability coefficient calculated
63 private double standardizedAlpha = Double.NaN; // Cronbach standardized data alpha reliability coefficient
64 private boolean standardizedAlphaCalculated = false; // = true when standardized alpha reliability coefficient calculated
65
66 private int deletedItemIndex = -1; // the index of the least consistent item
67 private String deletedFilename = null; // File name of new data file with least consistent item deleted
68
69
70 // CONSTRUCTOR
71 public Cronbach(){
72 super();
73 }
74
75 // CRONBACH RAW DATA ALPHA
76 public double rawAlpha(){
77
78 if(!this.rawAlphaCalculated){
79
80 if(this.nItems==1){
81 System.out.println("Method rawAlpha: only one item - alpha cannot be calculated - NaN returned");
82 this.rawAlpha = Double.NaN;
83 }
84 else{
85
86 // Check that data is preprocessed
87 if(!this.dataPreprocessed)this.preprocessData();
88
89 // (Sum of scores1) squared
90 double rawAllResponsesTotalAllSquared = this.rawAllResponsesTotal*this.rawAllResponsesTotal;
91
92 // Sum of (scores1 squared)
93 double sumOfEachScoreSquared = 0.0;
94 for(int i=0;i<this.nItems;i++){
95 for(int j=0;j<this.nPersons;j++)sumOfEachScoreSquared += scores1[j][i]*scores1[j][i];
96 }
97
98
99 // Reduced sum of column totals squared
100 double reducedItemTotalsSquared = 0.0;
101 for(int i=0;i<this.nItems;i++)reducedItemTotalsSquared += rawItemTotals[i]*rawItemTotals[i]/this.nPersons;
102
103 // Reduced sum of row totals squared
104 double reducedPersonTotalsSquared = 0.0;
105 for(int i=0;i<this.nPersons;i++)reducedPersonTotalsSquared += rawPersonTotals[i]*rawPersonTotals[i]/this.nItems;
106
107 //Sum of squares within persons
108 double sumOfSquaresWithinPersons = reducedPersonTotalsSquared - rawAllResponsesTotalAllSquared/this.nScores;
109
110 //Sum of square errors
111 double sumOfSquareErrors = sumOfEachScoreSquared - reducedItemTotalsSquared - reducedPersonTotalsSquared + rawAllResponsesTotalAllSquared/this.nScores;
112
113 //Degrees of freedom
114 //iiems
115 int dfItems = this.nItems- 1;
116 //persons
117 int dfPersons = this.nPersons - 1;
118 // errors
119 int dfErrors = dfItems*dfPersons;
120
121 // Mean Squares
122 double reducedSquarePersons = sumOfSquaresWithinPersons/dfPersons;
123 double reducedSquareErrors = sumOfSquareErrors/dfErrors;
124
125 // Cronbach raw alpha reliability coefficient
126 this.rawAlpha = (reducedSquarePersons - reducedSquareErrors)/reducedSquarePersons;
127 this.rawAlphaCalculated = true;
128 }
129 }
130 return this.rawAlpha;
131 }
132
133
134
135 // CRONBACH STANDARDIZED DATA ALPHA
136 public double standardizedAlpha(){
137
138 if(!this.standardizedAlphaCalculated){
139
140 if(this.nItems==1){
141 System.out.println("Method standardizedAlpha: only one item - alpha cannot be calculated - NaN returned");
142 this.rawAlpha = Double.NaN;
143 }
144 else{
145
146 // Check that data is preprocessed
147 if(!this.dataPreprocessed)this.preprocessData();
148
149 // Calculate correlation coefficients
150 if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients();
151
152 // Cronbach standardized alpha reliability coefficient
153 this.standardizedAlpha = this.nItems*this.rawMeanRhoWithoutTotals/(1.0 + (this.nItems - 1)*this.rawMeanRhoWithoutTotals);
154 this.standardizedAlphaCalculated = true;
155 }
156 }
157
158 return this.standardizedAlpha;
159 }
160
161 public double standardisedAlpha(){
162 return this.standardizedAlpha();
163 }
164
165
166
167
168
169 // OUTPUT THE ANALYSIS
170
171 // Full analysis without output of input data
172 // no input file name entered via method argument list
173 public void analysis(){
174
175 this.outputFilename = "CronbachOutput";
176 if(this.fileOption==1){
177 this.outputFilename += ".txt";
178 }
179 else{
180 this.outputFilename += ".xls";
181 }
182 String message1 = "Output file name for the analysis details:";
183 String message2 = "\nEnter the required name (as a single word) and click OK ";
184 String message3 = "\nor simply click OK for default value";
185 String message = message1 + message2 + message3;
186 String defaultName = this.outputFilename;
187 this.outputFilename = Db.readLine(message, defaultName);
188 this.analysis(this.outputFilename);
189 }
190
191 // Full analysis without output of input data
192 // input file name via method argument list
193 public void analysis(String filename){
194 // Open output file
195 this.outputFilename = filename;
196 String outputFilenameWithoutExtension = null;
197 String extension = null;
198 int pos = filename.indexOf('.');
199 if(pos==-1){
200 outputFilenameWithoutExtension = filename;
201 if(this.fileOption==1){
202 this.outputFilename += ".txt";
203 }
204 else{
205 this.outputFilename += ".xls";
206 }
207 }
208 else{
209 extension = (filename.substring(pos)).trim();
210
211 outputFilenameWithoutExtension = (filename.substring(0, pos)).trim();
212 if(extension.equalsIgnoreCase(".xls")){
213 if(this.fileOption==1){
214 if(this.fileOptionSet){
215 String message1 = "Your entered output file type is .xls";
216 String message2 = "\nbut you have chosen a .txt output";
217 String message = message1 + message2;
218 String headerComment = "Your output file name extension";
219 String[] comments = {message, "replace it with .txt [text file]"};
220 String[] boxTitles = {"Retain", ".txt"};
221 int defaultBox = 1;
222 int opt = Db.optionBox(headerComment, comments, boxTitles, defaultBox);
223 if(opt==2)this.outputFilename = outputFilenameWithoutExtension + ".txt";
224 }
225 else{
226 this.fileOption=2;
227 }
228 }
229 }
230
231 if(extension.equalsIgnoreCase(".txt")){
232 if(this.fileOption==2){
233 if(this.fileOptionSet){
234 String message1 = "Your entered output file type is .txt";
235 String message2 = "\nbut you have chosen a .xls output";
236 String message = message1 + message2;
237 String headerComment = "Your output file name extension";
238 String[] comments = {message, "replace it with .xls [Excel file]"};
239 String[] boxTitles = {"Retain", ".xls"};
240 int defaultBox = 1;
241 int opt = Db.optionBox(headerComment, comments, boxTitles, defaultBox);
242 if(opt==2)this.outputFilename = outputFilenameWithoutExtension + ".xls";
243 }
244 else{
245 this.fileOption=1;
246 }
247 }
248 }
249
250 if(!extension.equalsIgnoreCase(".txt") && !extension.equalsIgnoreCase(".xls")){
251 String message1 = "Your extension is " + extension;
252 String message2 = "\n Do you wish to retain it:";
253 String message = message1 + message2;
254 String headerComment = "Your output file name extension";
255 String[] comments = {message, "replace it with .txt [text file]", "replace it with .xls [MS Excel file]"};
256 String[] boxTitles = {"Retain", ".txt", ".xls"};
257 int defaultBox = 1;
258 int opt = Db.optionBox(headerComment, comments, boxTitles, defaultBox);
259 switch(opt){
260 case 1: this.fileOption=1;
261 break;
262 case 2: this.outputFilename = outputFilenameWithoutExtension + ".txt";
263 this.fileOption=1;
264 break;
265 case 3: this.outputFilename = outputFilenameWithoutExtension + ".xls";
266 this.fileOption=2;
267 break;
268 }
269 }
270 }
271
272 if(this.fileOption==1){
273 this.analysisText();
274 }
275 else{
276 this.analysisExcel();
277 }
278 }
279
280 private void analysisExcel(){
281
282 FileOutput fout = null;
283 if(this.fileNumberingSet){
284 fout = new FileOutput(this.outputFilename, 'n');
285 }
286 else{
287 fout = new FileOutput(this.outputFilename);
288 }
289
290 // calculate alphas if not already calculated
291 if(!rawAlphaCalculated)this.rawAlpha();
292 if(!standardizedAlphaCalculated)this.standardizedAlpha();
293
294 // output title information
295
296 fout.println("CRONBACH'S ALPHA RELIABILITY ESTIMATOR");
297 fout.println("Program: Cronbach - Analysis Output");
298 for(int i=0; i<this.titleLines; i++)fout.println(title[i]);
299 Date d = new Date();
300 String day = DateFormat.getDateInstance().format(d);
301 String tim = DateFormat.getTimeInstance().format(d);
302 fout.println("Program executed at " + tim + " on " + day);
303 fout.println();
304
305 // output reliability estimators
306 fout.println("RELIABILITY ESTIMATORS");
307 fout.println("Cronbach's coefficient alpha");
308 fout.printtab("Raw data ");
309 fout.println(Fmath.truncate(this.rawAlpha, this.trunc));
310 fout.printtab("Standardized data ");
311 fout.println(Fmath.truncate(this.standardizedAlpha, this.trunc));
312 fout.println();
313
314 fout.println("Average of the inter-item correlation coefficients, excluding item totals");
315 fout.printtab("Raw data ");
316 fout.println(Fmath.truncate(this.rawMeanRhoWithoutTotals, this.trunc));
317 fout.printtab("Standardized data ");
318 fout.println(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, this.trunc));
319 fout.println();
320
321 fout.println("Average of the inter-item correlation coefficients, including item totals");
322 fout.printtab("Raw data ");
323 fout.println(Fmath.truncate(this.rawMeanRhoWithTotals, this.trunc));
324 fout.printtab("Standardized data ");
325 fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, this.trunc));
326 fout.println();
327
328 // output any deletions or replacements
329 fout.println("'NO RESPONSE' DELETIONS AND REPLACEMENTS");
330 // deleted persons
331 boolean deletionFlag = false;
332 if(this.nDeletedPersons!=0){
333 deletionFlag = true;
334 fout.printtab("Number of persons deleted ");
335 fout.println(this.nDeletedPersons);
336 fout.printtab("Indices of deleted persons: ");
337 for(int i=0; i<this.nDeletedPersons; i++)fout.printtab(this.deletedPersonsIndices[i]+1);
338 fout.println();
339 }
340 else{
341 fout.println("No persons were deleted ");
342 }
343
344 // deleted items
345 if(this.nDeletedItems!=0){
346 deletionFlag = true;
347 fout.printtab("Number of items deleted ");
348 fout.println(this.nDeletedItems);
349 fout.printtab("Names of deleted items: ");
350 for(int i=0; i<this.nDeletedItems; i++)fout.printtab(this.originalItemNames[this.deletedItemsIndices[i]]);
351 fout.println();
352 }
353 else{
354 fout.println("No items were deleted ");
355 }
356
357 // replacements
358 if(this.nReplacements!=0){
359 fout.printtab("Number of 'no responses' replaced ");
360 fout.println(this.nReplacements);
361 fout.printtab("Item name and person index of replacements: ");
362 for(int i=0; i<this.nReplacements; i++)fout.printtab(this.replacementIndices[i] + " ");
363 fout.println();
364 fout.printtab("Replacement option: ");
365 fout.println(this.replacementOptionNames[this.replacementOption-1]);
366 fout.println();
367 }
368 else{
369 if(deletionFlag){
370 fout.println("No 'no response' replacements, other than any above deletions, were made ");
371 }
372 else{
373 fout.println("No 'no response' replacements were made ");
374 }
375 }
376 fout.println();
377 fout.printtab("Number of items used ");
378 fout.println(this.nItems);
379 fout.printtab("Number of persons used ");
380 fout.println(this.nPersons);
381 fout.println();
382
383 // Correlation coefficients
384 fout.println("CORRELATION COEFFICIENTS");
385 fout.println("Correlation coefficients between items - raw data");
386 fout.printtab(" ");
387 for(int i=0; i<=this.nItems; i++)fout.printtab(this.itemNames[i]);
388 fout.println();
389 for(int i=0; i<=this.nItems; i++){
390 fout.printtab(this.itemNames[i]);
391 for(int j=0; j<=this.nItems; j++)fout.printtab(Fmath.truncate(this.rawCorrelationCoefficients[i][j], this.trunc));
392 fout.println();
393 }
394 fout.println();
395
396 fout.print("Average inter-item correlation coefficient (excluding total) ");
397 fout.println(Fmath.truncate(this.rawMeanRhoWithoutTotals, this.trunc));
398 fout.print("Standard deviation of the inter-item correlation coefficient (excluding total) ");
399 fout.println(Fmath.truncate(this.rawStandardDeviationRhoWithoutTotals, this.trunc));
400 fout.print("Average inter-item correlation coefficient (including total) ");
401 fout.println(Fmath.truncate(this.rawMeanRhoWithTotals, this.trunc));
402 fout.print("Standard deviation of the inter-item correlation coefficient (including total) ");
403 fout.println(Fmath.truncate(this.rawStandardDeviationRhoWithTotals, this.trunc));
404 fout.println();
405
406
407 fout.println("Correlation coefficients between items - standardized data");
408 fout.printtab(" ");
409 for(int i=0; i<=this.nItems; i++)fout.printtab(this.itemNames[i]);
410 fout.println();
411 for(int i=0; i<=this.nItems; i++){
412 fout.printtab(this.itemNames[i]);
413 for(int j=0; j<=this.nItems; j++)fout.printtab(Fmath.truncate(this.standardizedCorrelationCoefficients[i][j], this.trunc));
414 fout.println();
415 }
416 fout.println();
417
418 fout.print("Average inter-item correlation coefficient (excluding total) ");
419 fout.println(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, this.trunc));
420 fout.print("Standard deviation of the inter-item correlation coefficient (excluding total) ");
421 fout.println(Fmath.truncate(this.standardizedStandardDeviationRhoWithoutTotals, this.trunc));
422 fout.print("Average inter-item correlation coefficient (including total) ");
423 fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, this.trunc));
424 fout.print("Standard deviation of the inter-item correlation coefficient (including total) ");
425 fout.println(Fmath.truncate(this.standardizedStandardDeviationRhoWithTotals, this.trunc));
426 fout.println();
427
428
429 // Item statistics
430 fout.println("ITEMS: MEANS, STANDARD DEVIATIONS, SKEWNESS AND KURTOSIS");
431 fout.println("Raw data");
432 fout.printtab("item ");
433 fout.printtab("mean");
434 fout.printtab("standard");
435 fout.printtab("moment");
436 fout.printtab("median");
437 fout.printtab("quartile");
438 fout.printtab("kurtosis");
439 fout.println("dichotomous");
440
441 fout.printtab(" ");
442 fout.printtab(" ");
443 fout.printtab("deviation");
444 fout.printtab("skewness");
445 fout.printtab("skewness");
446 fout.printtab("skewness");
447 fout.printtab("excess ");
448 fout.println("percentage");
449
450 for(int i=0; i<this.nItems; i++){
451 fout.printtab(this.itemNames[i]);
452 fout.printtab(Fmath.truncate(this.rawItemMeans[i], this.trunc));
453 fout.printtab(Fmath.truncate(this.rawItemStandardDeviations[i], this.trunc));
454 fout.printtab(Fmath.truncate(this.rawItemMomentSkewness[i], this.trunc));
455 fout.printtab(Fmath.truncate(this.rawItemMedianSkewness[i], this.trunc));
456 fout.printtab(Fmath.truncate(this.rawItemQuartileSkewness[i], this.trunc));
457 fout.printtab(Fmath.truncate(this.rawItemKurtosisExcess[i], this.trunc));
458 fout.println(Fmath.truncate(this.dichotomousPercentage[i], 1));
459 }
460 fout.println();
461
462 fout.println("ITEMS: MINIMA, MAXIMA, MEDIANS, RANGES AND TOTALS");
463 fout.println("raw data");
464 fout.printtab("item ");
465 fout.printtab("minimum");
466 fout.printtab("maximum");
467 fout.printtab("median");
468 fout.printtab("range");
469 fout.printtab("total");
470 fout.println("dichotomous");
471
472 fout.printtab(" ");
473 fout.printtab(" ");
474 fout.printtab(" ");
475 fout.printtab(" ");
476 fout.printtab(" ");
477 fout.printtab(" ");
478 fout.println("percentage");
479
480 for(int i=0; i<this.nItems; i++){
481 fout.printtab(this.itemNames[i]);
482 fout.printtab(Fmath.truncate(this.rawItemMinima[i], this.trunc));
483 fout.printtab(Fmath.truncate(this.rawItemMaxima[i], this.trunc));
484 fout.printtab(Fmath.truncate(this.rawItemMedians[i], this.trunc));
485 fout.printtab(Fmath.truncate(this.rawItemRanges[i], this.trunc));
486 fout.printtab(Fmath.truncate(this.rawItemTotals[i], this.trunc));
487 fout.println(Fmath.truncate(this.dichotomousPercentage[i], 1));
488 }
489 fout.println();
490
491 fout.printtab("item");
492 fout.printtab("mean");
493 fout.printtab("standard");
494 fout.printtab("variance");
495 fout.printtab("minimum");
496 fout.printtab("maximum");
497 fout.println("range");
498 fout.printtab("statistic ");
499 fout.printtab(" ");
500 fout.printtab("deviation");
501 fout.printtab(" ");
502 fout.printtab(" ");
503 fout.printtab(" ");
504 fout.printtab(" ");
505 fout.println(" ");
506
507 fout.printtab("item means");
508 fout.printtab(Fmath.truncate(this.rawItemMeansMean, this.trunc));
509 fout.printtab(Fmath.truncate(this.rawItemMeansSd, this.trunc));
510 fout.printtab(Fmath.truncate(this.rawItemMeansVar, this.trunc));
511 fout.printtab(Fmath.truncate(this.rawItemMeansMin, this.trunc));
512 fout.printtab(Fmath.truncate(this.rawItemMeansMax, this.trunc));
513 fout.println(Fmath.truncate(this.rawItemMeansRange, this.trunc));
514
515 fout.printtab("item standard deviations");
516 fout.printtab(Fmath.truncate(this.rawItemStandardDeviationsMean, this.trunc));
517 fout.printtab(Fmath.truncate(this.rawItemStandardDeviationsSd, this.trunc));
518 fout.printtab(Fmath.truncate(this.rawItemStandardDeviationsVar, this.trunc));
519 fout.printtab(Fmath.truncate(this.rawItemStandardDeviationsMin, this.trunc));
520 fout.printtab(Fmath.truncate(this.rawItemStandardDeviationsMax, this.trunc));
521 fout.println(Fmath.truncate(this.rawItemStandardDeviationsRange, this.trunc));
522
523 fout.printtab("item variances");
524 fout.printtab(Fmath.truncate(this.rawItemVariancesMean, this.trunc));
525 fout.printtab(Fmath.truncate(this.rawItemVariancesSd, this.trunc));
526 fout.printtab(Fmath.truncate(this.rawItemVariancesVar, this.trunc));
527 fout.printtab(Fmath.truncate(this.rawItemVariancesMin, this.trunc));
528 fout.printtab(Fmath.truncate(this.rawItemVariancesMax, this.trunc));
529 fout.println(Fmath.truncate(this.rawItemVariancesRange, this.trunc));
530
531 fout.printtab("item mimima");
532 fout.printtab(Fmath.truncate(this.rawItemMinimaMean, this.trunc));
533 fout.printtab(Fmath.truncate(this.rawItemMinimaSd, this.trunc));
534 fout.printtab(Fmath.truncate(this.rawItemMinimaVar, this.trunc));
535 fout.printtab(Fmath.truncate(this.rawItemMinimaMin, this.trunc));
536 fout.printtab(Fmath.truncate(this.rawItemMinimaMax, this.trunc));
537 fout.println(Fmath.truncate(this.rawItemMinimaRange, this.trunc));
538
539 fout.printtab("item maxima");
540 fout.printtab(Fmath.truncate(this.rawItemMaximaMean, this.trunc));
541 fout.printtab(Fmath.truncate(this.rawItemMaximaSd, this.trunc));
542 fout.printtab(Fmath.truncate(this.rawItemMaximaVar, this.trunc));
543 fout.printtab(Fmath.truncate(this.rawItemMaximaMin, this.trunc));
544 fout.printtab(Fmath.truncate(this.rawItemMaximaMax, this.trunc));
545 fout.println(Fmath.truncate(this.rawItemMaximaRange, this.trunc));
546
547 fout.printtab("item medians");
548 fout.printtab(Fmath.truncate(this.rawItemMediansMean, this.trunc));
549 fout.printtab(Fmath.truncate(this.rawItemMediansSd, this.trunc));
550 fout.printtab(Fmath.truncate(this.rawItemMediansVar, this.trunc));
551 fout.printtab(Fmath.truncate(this.rawItemMediansMin, this.trunc));
552 fout.printtab(Fmath.truncate(this.rawItemMediansMax, this.trunc));
553 fout.println(Fmath.truncate(this.rawItemMediansRange, this.trunc));
554
555 fout.printtab("item ranges");
556 fout.printtab(Fmath.truncate(this.rawItemRangesMean, this.trunc));
557 fout.printtab(Fmath.truncate(this.rawItemRangesSd, this.trunc));
558 fout.printtab(Fmath.truncate(this.rawItemRangesVar, this.trunc));
559 fout.printtab(Fmath.truncate(this.rawItemRangesMin, this.trunc));
560 fout.printtab(Fmath.truncate(this.rawItemRangesMax, this.trunc));
561 fout.println(Fmath.truncate(this.rawItemRangesRange, this.trunc));
562
563 fout.printtab("item totals");
564 fout.printtab(Fmath.truncate(this.rawItemTotalsMean, this.trunc));
565 fout.printtab(Fmath.truncate(this.rawItemTotalsSd, this.trunc));
566 fout.printtab(Fmath.truncate(this.rawItemTotalsVar, this.trunc));
567 fout.printtab(Fmath.truncate(this.rawItemTotalsMin, this.trunc));
568 fout.printtab(Fmath.truncate(this.rawItemTotalsMax, this.trunc));
569 fout.println(Fmath.truncate(this.rawItemTotalsRange, this.trunc));
570
571 fout.println();
572
573 fout.println("Standardized data");
574 fout.println("ITEMS: MEANS, STANDARD DEVIATIONS, SKEWNESS AND KURTOSIS");
575 fout.printtab("item ");
576 fout.printtab("mean");
577 fout.printtab("standard");
578 fout.printtab("moment");
579 fout.printtab("median");
580 fout.printtab("quartile");
581 fout.println("kurtosis");
582
583 fout.printtab(" ");
584 fout.printtab(" ");
585 fout.printtab("deviation");
586 fout.printtab("skewness");
587 fout.printtab("skewness");
588 fout.printtab("skewness");
589 fout.println("excess ");
590
591 for(int i=0; i<this.nItems; i++){
592 fout.printtab(this.itemNames[i]);
593 fout.printtab(Fmath.truncate(this.standardizedItemMeans[i], this.trunc));
594 fout.printtab(Fmath.truncate(this.standardizedItemStandardDeviations[i], this.trunc));
595 fout.printtab(Fmath.truncate(this.standardizedItemMomentSkewness[i], this.trunc));
596 fout.printtab(Fmath.truncate(this.standardizedItemMedianSkewness[i], this.trunc));
597 fout.printtab(Fmath.truncate(this.standardizedItemQuartileSkewness[i], this.trunc));
598 fout.println(Fmath.truncate(this.standardizedItemKurtosisExcess[i], this.trunc));
599 }
600 fout.println();
601
602 fout.println("ITEMS: MINIMA, MAXIMA, MEDIANS, RANGES AND TOTALS");
603 fout.println("Standardized data");
604 fout.printtab("item ");
605 fout.printtab("minimum");
606 fout.printtab("maximum");
607 fout.printtab("median");
608 fout.printtab("range");
609 fout.println("total");
610
611 fout.printtab(" ");
612 fout.printtab(" ");
613 fout.printtab(" ");
614 fout.printtab(" ");
615 fout.printtab(" ");
616 fout.println(" ");
617
618 for(int i=0; i<this.nItems; i++){
619 fout.printtab(this.itemNames[i]);
620 fout.printtab(Fmath.truncate(this.standardizedItemMinima[i], this.trunc));
621 fout.printtab(Fmath.truncate(this.standardizedItemMaxima[i], this.trunc));
622 fout.printtab(Fmath.truncate(this.standardizedItemMedians[i], this.trunc));
623 fout.printtab(Fmath.truncate(this.standardizedItemRanges[i], this.trunc));
624 fout.println(Fmath.truncate(this.standardizedItemTotals[i], this.trunc));
625 }
626 fout.println();
627
628
629
630 fout.printtab("item");
631 fout.printtab("mean");
632 fout.printtab("standard");
633 fout.printtab("variance");
634 fout.printtab("minimum");
635 fout.printtab("maximum");
636 fout.println("range");
637
638 fout.printtab("statistic ");
639 fout.printtab(" ");
640 fout.printtab("deviation");
641 fout.printtab(" ");
642 fout.printtab(" ");
643 fout.printtab(" ");
644 fout.printtab(" ");
645 fout.println(" ");
646
647 fout.printtab("item means");
648 fout.printtab(Fmath.truncate(this.standardizedItemMeansMean, this.trunc));
649 fout.printtab(Fmath.truncate(this.standardizedItemMeansSd, this.trunc));
650 fout.printtab(Fmath.truncate(this.standardizedItemMeansVar, this.trunc));
651 fout.printtab(Fmath.truncate(this.standardizedItemMeansMin, this.trunc));
652 fout.printtab(Fmath.truncate(this.standardizedItemMeansMax, this.trunc));
653 fout.println(Fmath.truncate(this.standardizedItemMeansRange, this.trunc));
654
655 fout.printtab("item standard deviations");
656 fout.printtab(Fmath.truncate(this.standardizedItemStandardDeviationsMean, this.trunc));
657 fout.printtab(Fmath.truncate(this.standardizedItemStandardDeviationsSd, this.trunc));
658 fout.printtab(Fmath.truncate(this.standardizedItemStandardDeviationsVar, this.trunc));
659 fout.printtab(Fmath.truncate(this.standardizedItemStandardDeviationsMin, this.trunc));
660 fout.printtab(Fmath.truncate(this.standardizedItemStandardDeviationsMax, this.trunc));
661 fout.println(Fmath.truncate(this.standardizedItemStandardDeviationsRange, this.trunc));
662
663 fout.printtab("item variances");
664 fout.printtab(Fmath.truncate(this.standardizedItemVariancesMean, this.trunc));
665 fout.printtab(Fmath.truncate(this.standardizedItemVariancesSd, this.trunc));
666 fout.printtab(Fmath.truncate(this.standardizedItemVariancesVar, this.trunc));
667 fout.printtab(Fmath.truncate(this.standardizedItemVariancesMin, this.trunc));
668 fout.printtab(Fmath.truncate(this.standardizedItemVariancesMax, this.trunc));
669 fout.println(Fmath.truncate(this.standardizedItemVariancesRange, this.trunc));
670
671 fout.printtab("item mimima");
672 fout.printtab(Fmath.truncate(this.standardizedItemMinimaMean, this.trunc));
673 fout.printtab(Fmath.truncate(this.standardizedItemMinimaSd, this.trunc));
674 fout.printtab(Fmath.truncate(this.standardizedItemMinimaVar, this.trunc));
675 fout.printtab(Fmath.truncate(this.standardizedItemMinimaMin, this.trunc));
676 fout.printtab(Fmath.truncate(this.standardizedItemMinimaMax, this.trunc));
677 fout.println(Fmath.truncate(this.standardizedItemMinimaRange, this.trunc));
678
679 fout.printtab("item maxima");
680 fout.printtab(Fmath.truncate(this.standardizedItemMaximaMean, this.trunc));
681 fout.printtab(Fmath.truncate(this.standardizedItemMaximaSd, this.trunc));
682 fout.printtab(Fmath.truncate(this.standardizedItemMaximaVar, this.trunc));
683 fout.printtab(Fmath.truncate(this.standardizedItemMaximaMin, this.trunc));
684 fout.printtab(Fmath.truncate(this.standardizedItemMaximaMax, this.trunc));
685 fout.println(Fmath.truncate(this.standardizedItemMaximaRange, this.trunc));
686
687 fout.print("item medians");
688 fout.print(Fmath.truncate(this.rawItemMediansMean, this.trunc));
689 fout.print(Fmath.truncate(this.rawItemMediansSd, this.trunc));
690 fout.print(Fmath.truncate(this.rawItemMediansVar, this.trunc));
691 fout.print(Fmath.truncate(this.rawItemMediansMin, this.trunc));
692 fout.print(Fmath.truncate(this.rawItemMediansMax, this.trunc));
693 fout.println(Fmath.truncate(this.rawItemMediansRange, this.trunc));
694
695 fout.printtab("item ranges");
696 fout.printtab(Fmath.truncate(this.standardizedItemRangesMean, this.trunc));
697 fout.printtab(Fmath.truncate(this.standardizedItemRangesSd, this.trunc));
698 fout.printtab(Fmath.truncate(this.standardizedItemRangesVar, this.trunc));
699 fout.printtab(Fmath.truncate(this.standardizedItemRangesMin, this.trunc));
700 fout.printtab(Fmath.truncate(this.standardizedItemRangesMax, this.trunc));
701 fout.println(Fmath.truncate(this.standardizedItemRangesRange, this.trunc));
702
703 fout.printtab("item totals");
704 fout.printtab(Fmath.truncate(this.standardizedItemTotalsMean, this.trunc));
705 fout.printtab(Fmath.truncate(this.standardizedItemTotalsSd, this.trunc));
706 fout.printtab(Fmath.truncate(this.standardizedItemTotalsVar, this.trunc));
707 fout.printtab(Fmath.truncate(this.standardizedItemTotalsMin, this.trunc));
708 fout.printtab(Fmath.truncate(this.standardizedItemTotalsMax, this.trunc));
709 fout.println(Fmath.truncate(this.standardizedItemTotalsRange, this.trunc));
710
711 fout.println();
712
713 fout.println("DELETION OF ITEMS");
714
715 fout.printtab(" ");
716 fout.printtab("Raw data ");
717 fout.printtab(" ");
718 fout.printtab(" ");
719 fout.printtab(" ");
720 fout.println("Standardized data");
721
722 fout.printtab("Deleted item");
723 fout.printtab("Alpha ");
724 fout.printtab("Correlation ");
725 fout.printtab("Average ");
726 fout.printtab("Average ");
727 fout.printtab("Alpha ");
728 fout.printtab("Correlation ");
729 fout.printtab("Average ");
730 fout.println("Average ");
731
732
733 fout.printtab(" ");
734 fout.printtab(" ");
735 fout.printtab("coefficient");
736 fout.printtab("inter-item ");
737 fout.printtab("inter-item ");
738 fout.printtab(" ");
739 fout.printtab("coefficient ");
740 fout.printtab("inter-item ");
741 fout.println("inter-item ");
742
743
744 fout.printtab(" ");
745 fout.printtab(" ");
746 fout.printtab("with total ");
747 fout.printtab("correlation");
748 fout.printtab("correlation");
749 fout.printtab(" ");
750 fout.printtab("with total ");
751 fout.printtab("correlation");
752 fout.println("correlation");
753
754
755 fout.printtab(" ");
756 fout.printtab(" ");
757 fout.printtab(" ");
758 fout.printtab("coefficient");
759 fout.printtab("coefficient");
760 fout.printtab(" ");
761 fout.printtab(" ");
762 fout.printtab("coefficient");
763 fout.println("coefficient");
764
765
766 fout.printtab(" ");
767 fout.printtab(" ");
768 fout.printtab(" ");
769 fout.printtab("without totals");
770 fout.printtab("with totals ");
771 fout.printtab(" ");
772 fout.printtab(" ");
773 fout.printtab("without totals");
774 fout.println("with totals ");
775
776 double[] newRawAlpha = new double[this.nItems];
777 double[] newStandardizedAlpha = new double[this.nItems];
778 double[] newRawRho = new double[this.nItems];
779 double[] newStandardizedRho = new double[this.nItems];
780 for(int i=0; i<this.nItems; i++){
781 int index = i+1;
782 double[][] newScore1 = this.deleteItem(index);
783 Cronbach cr = new Cronbach();
784 cr.enterScoresAsRowPerPerson(newScore1);
785 double rawAlphaD = cr.rawAlpha();
786 newRawAlpha[i] = rawAlphaD;
787 double rawMeanRhoWithTotalsD = cr.rawAverageCorrelationCoefficientsWithTotals();
788 double rawMeanRhoWithoutTotalsD = cr.rawAverageCorrelationCoefficients();
789 double[] rawPersonTotalsD = cr.rawPersonTotals();
790 double rawRhoAgainstTotalsD = Stat.corrCoeff(rawPersonTotalsD, this.scores0[i]);
791 newRawRho[i] = rawRhoAgainstTotalsD;
792
793 double standardizedAlphaD = cr.standardizedAlpha();
794 newStandardizedAlpha[i] = standardizedAlphaD;
795 double standardizedMeanRhoWithTotalsD = cr.standardizedAverageCorrelationCoefficientsWithTotals();
796 double standardizedMeanRhoWithoutTotalsD = cr.standardizedAverageCorrelationCoefficients();
797 double[] standardizedPersonTotalsD = cr.standardizedPersonTotals();
798 double standardizedRhoAgainstTotalsD = Stat.corrCoeff(standardizedPersonTotalsD, this.scores0[i]);
799 newStandardizedRho[i] = standardizedRhoAgainstTotalsD;
800
801 fout.printtab(this.itemNames[i]);
802 fout.printtab(Fmath.truncate(rawAlphaD, trunc));
803 fout.printtab(Fmath.truncate(rawRhoAgainstTotalsD, trunc));
804 fout.printtab(Fmath.truncate(rawMeanRhoWithoutTotalsD, trunc));
805 fout.printtab(Fmath.truncate(rawMeanRhoWithTotalsD, trunc));
806
807 fout.printtab(Fmath.truncate(standardizedAlphaD, trunc));
808 fout.printtab(Fmath.truncate(standardizedRhoAgainstTotalsD, trunc));
809 fout.printtab(Fmath.truncate(standardizedMeanRhoWithoutTotalsD, trunc));
810 fout.println(Fmath.truncate(standardizedMeanRhoWithTotalsD, trunc));
811 }
812 fout.println();
813
814 fout.printtab("No item deleted");
815 fout.printtab(Fmath.truncate(this.rawAlpha, trunc));
816 fout.printtab(" ");
817 fout.printtab(Fmath.truncate(this.rawMeanRhoWithoutTotals, trunc));
818 fout.printtab(Fmath.truncate(this.rawMeanRhoWithTotals, trunc));
819
820 fout.printtab(Fmath.truncate(this.standardizedAlpha, trunc));
821 fout.printtab(" ");
822 fout.printtab(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, trunc));
823 fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, trunc));
824 fout.println();
825
826 // output a deleted item data file
827 this.deletedItemDataFile(newRawAlpha, newRawRho, newStandardizedAlpha, newStandardizedRho);
828
829
830 fout.println("INDIVIDUALS - raw data");
831 fout.printtab("person ");
832 fout.printtab("mean");
833 fout.printtab("standard");
834 fout.printtab("minimum");
835 fout.printtab("maximum");
836 fout.printtab("range");
837 fout.printtab("total");
838 fout.println("scores:");
839
840 fout.printtab(" ");
841 fout.printtab(" ");
842 fout.printtab("deviation");
843 fout.printtab(" ");
844 fout.printtab(" ");
845 fout.printtab(" ");
846 fout.printtab(" ");
847 for(int i=0; i<this.nItems; i++)fout.printtab(this.itemNames[i]);
848 fout.println();
849
850 for(int i=0; i<this.nPersons; i++){
851 fout.printtab((this.personIndices[i]+1));
852 fout.printtab(Fmath.truncate(this.rawPersonMeans[i], this.trunc));
853 fout.printtab(Fmath.truncate(this.rawPersonStandardDeviations[i], this.trunc));
854 fout.printtab(Fmath.truncate(this.rawPersonMinima[i], this.trunc));
855 fout.printtab(Fmath.truncate(this.rawPersonMaxima[i], this.trunc));
856 fout.printtab(Fmath.truncate(this.rawPersonRanges[i], this.trunc));
857 fout.printtab(Fmath.truncate(this.rawPersonTotals[i], this.trunc));
858 for(int j=0; j<this.nItems; j++)fout.printtab(Fmath.truncate(this.scores1[i][j], this.trunc));
859 fout.println();
860 }
861 fout.println();
862
863 fout.println("INDIVIDUALS - standardized data");
864 fout.printtab("person ");
865 fout.printtab("mean");
866 fout.printtab("standard");
867 fout.printtab("minimum");
868 fout.printtab("maximum");
869 fout.printtab("range");
870 fout.printtab("total");
871 fout.println("scores:");
872
873 fout.printtab(" ");
874 fout.printtab(" ");
875 fout.printtab("deviation");
876 fout.printtab(" ");
877 fout.printtab(" ");
878 fout.printtab(" ");
879 fout.printtab(" ");
880 for(int i=0; i<this.nItems; i++)fout.printtab(this.itemNames[i]);
881 fout.println();
882
883
884 for(int i=0; i<this.nPersons; i++){
885 fout.printtab((this.personIndices[i]+1));
886 fout.printtab(Fmath.truncate(this.standardizedPersonMeans[i], this.trunc));
887 fout.printtab(Fmath.truncate(this.standardizedPersonStandardDeviations[i], this.trunc));
888 fout.printtab(Fmath.truncate(this.standardizedPersonMinima[i], this.trunc));
889 fout.printtab(Fmath.truncate(this.standardizedPersonMaxima[i], this.trunc));
890 fout.printtab(Fmath.truncate(this.standardizedPersonRanges[i], this.trunc));
891 fout.printtab(Fmath.truncate(this.standardizedPersonTotals[i], this.trunc));
892 for(int j=0; j<this.nItems; j++)fout.printtab(Fmath.truncate(this.standardizedScores1[i][j], this.trunc));
893 fout.println();
894 }
895 fout.println();
896
897 fout.println("ALL SCORES - raw data");
898
899 fout.printtab("mean");
900 fout.printtab("standard");
901 fout.printtab("minimum");
902 fout.printtab("maximum");
903 fout.printtab("range");
904 fout.println("overall");
905 fout.printtab(" ");
906 fout.printtab("deviation");
907 fout.printtab(" ");
908 fout.printtab(" ");
909 fout.printtab(" ");
910 fout.println("total");
911
912 fout.printtab(Fmath.truncate(this.rawAllResponsesMean, this.trunc));
913 fout.printtab(Fmath.truncate(this.rawAllResponsesStandardDeviation, this.trunc));
914 fout.printtab(Fmath.truncate(this.rawAllResponsesMinimum, this.trunc));
915 fout.printtab(Fmath.truncate(this.rawAllResponsesMaximum, this.trunc));
916 fout.printtab(Fmath.truncate(this.rawAllResponsesRange, this.trunc));
917 fout.println(Fmath.truncate(this.rawAllResponsesTotal, this.trunc));
918 fout.println();
919
920 fout.println("ALL SCORES - standardized data");
921
922 fout.printtab("mean");
923 fout.printtab("standard");
924 fout.printtab("minimum");
925 fout.printtab("maximum");
926 fout.printtab("range");
927 fout.println("overall");
928 fout.printtab(" ");
929 fout.printtab("deviation");
930 fout.printtab(" ");
931 fout.printtab(" ");
932 fout.printtab(" ");
933 fout.println("total");
934
935 fout.printtab(Fmath.truncate(this.standardizedAllResponsesMean, this.trunc));
936 fout.printtab(Fmath.truncate(this.standardizedAllResponsesStandardDeviation, this.trunc));
937 fout.printtab(Fmath.truncate(this.standardizedAllResponsesMinimum, this.trunc));
938 fout.printtab(Fmath.truncate(this.standardizedAllResponsesMaximum, this.trunc));
939 fout.printtab(Fmath.truncate(this.standardizedAllResponsesRange, this.trunc));
940 fout.println(Fmath.truncate(this.standardizedAllResponsesTotal, this.trunc));
941 fout.println();
942
943 // close output file
944 fout.close();
945 }
946
947
948 private void analysisText(){
949
950 FileOutput fout = null;
951 if(this.fileNumberingSet){
952 fout = new FileOutput(this.outputFilename, 'n');
953 }
954 else{
955 fout = new FileOutput(this.outputFilename);
956 }
957
958 // calculate alphas if not already calculated
959 if(!rawAlphaCalculated)this.rawAlpha();
960 if(!standardizedAlphaCalculated)this.standardizedAlpha();
961
962 // output title information
963 fout.println("CRONBACH'S ALPHA RELIABILITY ESTIMATOR");
964 fout.println("Program: Cronbach - Analysis Output");
965 for(int i=0; i<this.titleLines; i++)fout.println(title[i]);
966 Date d = new Date();
967 String day = DateFormat.getDateInstance().format(d);
968 String tim = DateFormat.getTimeInstance().format(d);
969 fout.println("Program executed at " + tim + " on " + day);
970 fout.println();
971
972 // output reliability estimators
973 int field = 36; // field width
974 fout.println("RELIABILITY ESTIMATORS");
975 fout.println("Cronbach's coefficient alpha");
976 fout.print("Raw data ", field);
977 fout.println(Fmath.truncate(this.rawAlpha, this.trunc));
978 fout.print("Standardized data ", field);
979 fout.println(Fmath.truncate(this.standardizedAlpha, this.trunc));
980 fout.println();
981
982 fout.println("Average of the inter-item correlation coefficients, excluding item totals");
983 fout.print("Raw data ", field);
984 fout.println(Fmath.truncate(this.rawMeanRhoWithoutTotals, this.trunc));
985 fout.print("Standardized data ", field);
986 fout.println(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, this.trunc));
987 fout.println();
988
989 fout.println("Average of the inter-item correlation coefficients, including item totals");
990 fout.print("Raw data ", field);
991 fout.println(Fmath.truncate(this.rawMeanRhoWithTotals, this.trunc));
992 fout.print("Standardized data ", field);
993 fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, this.trunc));
994 fout.println();
995
996 // output any deletions or replacements
997 fout.println("'NO RESPONSE' DELETIONS AND REPLACEMENTS");
998 // deleted persons
999 field = 34;
1000 int fieldInt = 6;
1001 boolean deletionFlag = false;
1002 if(this.nDeletedPersons!=0){
1003 deletionFlag = true;
1004 fout.print("Number of persons deleted ", field);
1005 fout.println(this.nDeletedPersons);
1006 fout.print("Indices of deleted persons: ", field);
1007 for(int i=0; i<this.nDeletedPersons; i++)fout.print((this.deletedPersonsIndices[i]+1), fieldInt);
1008 fout.println();
1009 }
1010 else{
1011 fout.println("No persons were deleted ");
1012 }
1013
1014 // deleted items
1015 if(this.nDeletedItems!=0){
1016 deletionFlag = true;
1017 fout.print("Number of items deleted ", field);
1018 fout.println(this.nDeletedItems);
1019 fout.print("Names of deleted items: ", field);
1020 for(int i=0; i<this.nDeletedItems; i++)fout.print(this.originalItemNames[this.deletedItemsIndices[i]], fieldInt);
1021 fout.println();
1022 }
1023 else{
1024 fout.println("No items were deleted ");
1025 }
1026
1027 // replacements
1028 if(this.nReplacements!=0){
1029 fout.printtab("Number of 'no responses' replaced ");
1030 fout.println(this.nReplacements);
1031 fout.print("Item name and person index of replacements: ", 50);
1032 for(int i=0; i<this.nReplacements; i++)fout.print((this.replacementIndices[i]+" "), fieldInt);
1033 fout.println();
1034 fout.print("Replacement option: ", field);
1035 fout.println(this.replacementOptionNames[this.replacementOption-1]);
1036 fout.println();
1037 }
1038 else{
1039 if(deletionFlag){
1040 fout.println("No 'no response' replacements, other than any above deletions, were made ");
1041 }
1042 else{
1043 fout.println("No 'no response' replacements were made ");
1044 }
1045 }
1046 fout.println();
1047 fout.print("Number of items used", 35);
1048 fout.println(this.nItems);
1049 fout.print("Number of persons used", 35);
1050 fout.println(this.nPersons);
1051 fout.println();
1052
1053 // Correlation coefficients
1054 int len = this.trunc+8;
1055 int fieldItemName = 0;
1056 for(int i=0; i<=this.nItems; i++)if(this.itemNames[i].length()>fieldItemName)fieldItemName = this.itemNames[i].length();
1057 int fieldItemNumber = fieldItemName;
1058 if(len>fieldItemNumber)fieldItemNumber = len;
1059 fieldItemName++;
1060 fieldItemNumber++;
1061
1062 fout.println("CORRELATION COEFFICIENTS");
1063 fout.println("Correlation coefficients between items - raw data");
1064 fout.print(" ", fieldItemName);
1065
1066 for(int i=0; i<=this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
1067 fout.println();
1068 for(int i=0; i<=this.nItems; i++){
1069 fout.print(this.itemNames[i], fieldItemName);
1070 for(int j=0; j<=this.nItems; j++)fout.print(Fmath.truncate(this.rawCorrelationCoefficients[i][j], this.trunc), fieldItemNumber);
1071 fout.println();
1072 }
1073 fout.println();
1074
1075 fout.print("Average inter-item correlation coefficient (excluding total) ", 80);
1076 fout.println(Fmath.truncate(this.rawMeanRhoWithoutTotals, this.trunc));
1077 fout.print("Standard deviation of the inter-item correlation coefficient (excluding total) ", 80);
1078 fout.println(Fmath.truncate(this.rawStandardDeviationRhoWithoutTotals, this.trunc));
1079 fout.print("Average inter-item correlation coefficient (including total) ", 80);
1080 fout.println(Fmath.truncate(this.rawMeanRhoWithTotals, this.trunc));
1081 fout.print("Standard deviation of the inter-item correlation coefficient (including total) ", 80);
1082 fout.println(Fmath.truncate(this.rawStandardDeviationRhoWithTotals, this.trunc));
1083
1084 fout.println();
1085
1086
1087 fout.println("Correlation coefficients between items - standardized data");
1088 fout.print(" ", fieldItemName);
1089 for(int i=0; i<=this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
1090 fout.println();
1091 for(int i=0; i<=this.nItems; i++){
1092 fout.print(this.itemNames[i], fieldItemName);
1093 for(int j=0; j<=this.nItems; j++)fout.print(Fmath.truncate(this.standardizedCorrelationCoefficients[i][j], this.trunc), fieldItemNumber);
1094 fout.println();
1095 }
1096 fout.println();
1097
1098 fout.print("Average inter-item correlation coefficient (excluding total) ", 80);
1099 fout.println(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, this.trunc));
1100 fout.print("Standard deviation of the inter-item correlation coefficient (excluding total) ", 80);
1101 fout.println(Fmath.truncate(this.standardizedStandardDeviationRhoWithoutTotals, this.trunc));
1102 fout.print("Average inter-item correlation coefficient (including total) ", 80);
1103 fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, this.trunc));
1104 fout.print("Standard deviation of the inter-item correlation coefficient (including total) ", 80);
1105 fout.println(Fmath.truncate(this.standardizedStandardDeviationRhoWithTotals, this.trunc));
1106 fout.println();
1107
1108 // item statistics
1109 if(fieldItemNumber<12)fieldItemNumber = 12;
1110
1111 fout.println("ITEMS: MEANS, STANDARD DEVIATIONS, SKEWNESS AND KURTOSIS");
1112 fout.println("Raw data");
1113 fout.print("item ", fieldItemName);
1114 fout.print("mean", fieldItemNumber);
1115 fout.print("standard", fieldItemNumber);
1116 fout.print("moment", fieldItemNumber);
1117 fout.print("median", fieldItemNumber);
1118 fout.print("quartile", fieldItemNumber);
1119 fout.print("kurtosis", fieldItemNumber);
1120 fout.println("dichotomous");
1121
1122 fout.print(" ", fieldItemName);
1123 fout.print(" ", fieldItemNumber);
1124 fout.print("deviation", fieldItemNumber);
1125 fout.print("skewness", fieldItemNumber);
1126 fout.print("skewness", fieldItemNumber);
1127 fout.print("skewness", fieldItemNumber);
1128 fout.print("excess ", fieldItemNumber);
1129 fout.println("percentage");
1130
1131 for(int i=0; i<this.nItems; i++){
1132 fout.print(this.itemNames[i], fieldItemName);
1133 fout.print(Fmath.truncate(this.rawItemMeans[i], this.trunc), fieldItemNumber);
1134 fout.print(Fmath.truncate(this.rawItemStandardDeviations[i], this.trunc), fieldItemNumber);
1135 fout.print(Fmath.truncate(this.rawItemMomentSkewness[i], this.trunc), fieldItemNumber);
1136 fout.print(Fmath.truncate(this.rawItemMedianSkewness[i], this.trunc), fieldItemNumber);
1137 fout.print(Fmath.truncate(this.rawItemQuartileSkewness[i], this.trunc), fieldItemNumber);
1138 fout.print(Fmath.truncate(this.rawItemKurtosisExcess[i], this.trunc), fieldItemNumber);
1139 fout.println(Fmath.truncate(this.dichotomousPercentage[i], 1));
1140 }
1141 fout.println();
1142
1143 fout.println("ITEMS: MINIMA, MAXIMA, MEDIANS, RANGES AND TOTALS");
1144 fout.println("Raw data");
1145 fout.print("item ", fieldItemName);
1146 fout.print("minimum", fieldItemNumber);
1147 fout.print("maximum", fieldItemNumber);
1148 fout.print("median", fieldItemNumber);
1149 fout.print("range", fieldItemNumber);
1150 fout.print("total", fieldItemNumber);
1151 fout.println("dichotomous");
1152
1153 fout.print(" ", fieldItemName);
1154 fout.print(" ", fieldItemNumber);
1155 fout.print(" ", fieldItemNumber);
1156 fout.print(" ", fieldItemNumber);
1157 fout.print(" ", fieldItemNumber);
1158 fout.print(" ", fieldItemNumber);
1159 fout.println("percentage");
1160
1161 for(int i=0; i<this.nItems; i++){
1162 fout.print(this.itemNames[i], fieldItemName);
1163 fout.print(Fmath.truncate(this.rawItemMinima[i], this.trunc), fieldItemNumber);
1164 fout.print(Fmath.truncate(this.rawItemMaxima[i], this.trunc), fieldItemNumber);
1165 fout.print(Fmath.truncate(this.rawItemMedians[i], this.trunc), fieldItemNumber);
1166 fout.print(Fmath.truncate(this.rawItemRanges[i], this.trunc), fieldItemNumber);
1167 fout.print(Fmath.truncate(this.rawItemTotals[i], this.trunc), fieldItemNumber);
1168 fout.println(Fmath.truncate(this.dichotomousPercentage[i], 1));
1169 }
1170 fout.println();
1171
1172 int fieldItemSName = 25;
1173 fout.print("item", fieldItemSName);
1174 fout.print("mean", fieldItemNumber);
1175 fout.print("standard", fieldItemNumber);
1176 fout.print("variance", fieldItemNumber);
1177 fout.print("minimum", fieldItemNumber);
1178 fout.print("maximum", fieldItemNumber);
1179 fout.println("range");
1180 fout.print("statistic ", fieldItemSName);
1181 fout.print(" ", fieldItemNumber);
1182 fout.print("deviation", fieldItemNumber);
1183 fout.print(" ", fieldItemNumber);
1184 fout.print(" ", fieldItemNumber);
1185 fout.print(" ", fieldItemNumber);
1186 fout.print(" ", fieldItemNumber);
1187 fout.println(" ");
1188
1189 fout.print("item means", fieldItemSName);
1190 fout.print(Fmath.truncate(this.rawItemMeansMean, this.trunc), fieldItemNumber);
1191 fout.print(Fmath.truncate(this.rawItemMeansSd, this.trunc), fieldItemNumber);
1192 fout.print(Fmath.truncate(this.rawItemMeansVar, this.trunc), fieldItemNumber);
1193 fout.print(Fmath.truncate(this.rawItemMeansMin, this.trunc), fieldItemNumber);
1194 fout.print(Fmath.truncate(this.rawItemMeansMax, this.trunc), fieldItemNumber);
1195 fout.println(Fmath.truncate(this.rawItemMeansRange, this.trunc));
1196
1197 fout.print("item standard deviations", fieldItemSName);
1198 fout.print(Fmath.truncate(this.rawItemStandardDeviationsMean, this.trunc), fieldItemNumber);
1199 fout.print(Fmath.truncate(this.rawItemStandardDeviationsSd, this.trunc), fieldItemNumber);
1200 fout.print(Fmath.truncate(this.rawItemStandardDeviationsVar, this.trunc), fieldItemNumber);
1201 fout.print(Fmath.truncate(this.rawItemStandardDeviationsMin, this.trunc), fieldItemNumber);
1202 fout.print(Fmath.truncate(this.rawItemStandardDeviationsMax, this.trunc), fieldItemNumber);
1203 fout.println(Fmath.truncate(this.rawItemStandardDeviationsRange, this.trunc));
1204
1205 fout.print("item variances", fieldItemSName);
1206 fout.print(Fmath.truncate(this.rawItemVariancesMean, this.trunc), fieldItemNumber);
1207 fout.print(Fmath.truncate(this.rawItemVariancesSd, this.trunc), fieldItemNumber);
1208 fout.print(Fmath.truncate(this.rawItemVariancesVar, this.trunc), fieldItemNumber);
1209 fout.print(Fmath.truncate(this.rawItemVariancesMin, this.trunc), fieldItemNumber);
1210 fout.print(Fmath.truncate(this.rawItemVariancesMax, this.trunc), fieldItemNumber);
1211 fout.println(Fmath.truncate(this.rawItemVariancesRange, this.trunc));
1212
1213 fout.print("item mimima", fieldItemSName);
1214 fout.print(Fmath.truncate(this.rawItemMinimaMean, this.trunc), fieldItemNumber);
1215 fout.print(Fmath.truncate(this.rawItemMinimaSd, this.trunc), fieldItemNumber);
1216 fout.print(Fmath.truncate(this.rawItemMinimaVar, this.trunc), fieldItemNumber);
1217 fout.print(Fmath.truncate(this.rawItemMinimaMin, this.trunc), fieldItemNumber);
1218 fout.print(Fmath.truncate(this.rawItemMinimaMax, this.trunc), fieldItemNumber);
1219 fout.println(Fmath.truncate(this.rawItemMinimaRange, this.trunc));
1220
1221 fout.print("item maxima", fieldItemSName);
1222 fout.print(Fmath.truncate(this.rawItemMaximaMean, this.trunc), fieldItemNumber);
1223 fout.print(Fmath.truncate(this.rawItemMaximaSd, this.trunc), fieldItemNumber);
1224 fout.print(Fmath.truncate(this.rawItemMaximaVar, this.trunc), fieldItemNumber);
1225 fout.print(Fmath.truncate(this.rawItemMaximaMin, this.trunc), fieldItemNumber);
1226 fout.print(Fmath.truncate(this.rawItemMaximaMax, this.trunc), fieldItemNumber);
1227 fout.println(Fmath.truncate(this.rawItemMaximaRange, this.trunc));
1228
1229 fout.print("item medians", fieldItemSName);
1230 fout.print(Fmath.truncate(this.rawItemMediansMean, this.trunc), fieldItemNumber);
1231 fout.print(Fmath.truncate(this.rawItemMediansSd, this.trunc), fieldItemNumber);
1232 fout.print(Fmath.truncate(this.rawItemMediansVar, this.trunc), fieldItemNumber);
1233 fout.print(Fmath.truncate(this.rawItemMediansMin, this.trunc), fieldItemNumber);
1234 fout.print(Fmath.truncate(this.rawItemMediansMax, this.trunc), fieldItemNumber);
1235 fout.println(Fmath.truncate(this.rawItemMediansRange, this.trunc));
1236
1237 fout.print("item ranges", fieldItemSName);
1238 fout.print(Fmath.truncate(this.rawItemRangesMean, this.trunc), fieldItemNumber);
1239 fout.print(Fmath.truncate(this.rawItemRangesSd, this.trunc), fieldItemNumber);
1240 fout.print(Fmath.truncate(this.rawItemRangesVar, this.trunc), fieldItemNumber);
1241 fout.print(Fmath.truncate(this.rawItemRangesMin, this.trunc), fieldItemNumber);
1242 fout.print(Fmath.truncate(this.rawItemRangesMax, this.trunc), fieldItemNumber);
1243 fout.println(Fmath.truncate(this.rawItemRangesRange, this.trunc));
1244
1245 fout.print("item totals", fieldItemSName);
1246 fout.print(Fmath.truncate(this.rawItemTotalsMean, this.trunc), fieldItemNumber);
1247 fout.print(Fmath.truncate(this.rawItemTotalsSd, this.trunc), fieldItemNumber);
1248 fout.print(Fmath.truncate(this.rawItemTotalsVar, this.trunc), fieldItemNumber);
1249 fout.print(Fmath.truncate(this.rawItemTotalsMin, this.trunc), fieldItemNumber);
1250 fout.print(Fmath.truncate(this.rawItemTotalsMax, this.trunc), fieldItemNumber);
1251 fout.println(Fmath.truncate(this.rawItemTotalsRange, this.trunc));
1252
1253 fout.println();
1254
1255 fout.println("standardized data");
1256 fout.print("item ", fieldItemName);
1257 fout.print("mean", fieldItemNumber);
1258 fout.print("standard", fieldItemNumber);
1259 fout.print("moment", fieldItemNumber);
1260 fout.print("median", fieldItemNumber);
1261 fout.print("quartile", fieldItemNumber);
1262 fout.println("kurtosis");
1263
1264 fout.print(" ", fieldItemName);
1265 fout.print(" ", fieldItemNumber);
1266 fout.print("deviation", fieldItemNumber);
1267 fout.print("skewness", fieldItemNumber);
1268 fout.print("skewness", fieldItemNumber);
1269 fout.print("skewness", fieldItemNumber);
1270 fout.println("excess ");
1271
1272 for(int i=0; i<this.nItems; i++){
1273 fout.print(this.itemNames[i], fieldItemName);
1274 fout.print(Fmath.truncate(this.standardizedItemMeans[i], this.trunc), fieldItemNumber);
1275 fout.print(Fmath.truncate(this.standardizedItemStandardDeviations[i], this.trunc), fieldItemNumber);
1276 fout.print(Fmath.truncate(this.standardizedItemMomentSkewness[i], this.trunc), fieldItemNumber);
1277 fout.print(Fmath.truncate(this.standardizedItemMedianSkewness[i], this.trunc), fieldItemNumber);
1278 fout.print(Fmath.truncate(this.standardizedItemQuartileSkewness[i], this.trunc), fieldItemNumber);
1279 fout.println(Fmath.truncate(this.standardizedItemKurtosisExcess[i], this.trunc));
1280 }
1281 fout.println();
1282
1283 fout.print("item ", fieldItemName);
1284 fout.print("minimum", fieldItemNumber);
1285 fout.print("maximum", fieldItemNumber);
1286 fout.print("median", fieldItemNumber);
1287 fout.print("range", fieldItemNumber);
1288 fout.println("total");
1289
1290 fout.print(" ", fieldItemName);
1291 fout.print(" ", fieldItemNumber);
1292 fout.print(" ", fieldItemNumber);
1293 fout.print(" ", fieldItemNumber);
1294 fout.print(" ", fieldItemNumber);
1295 fout.println(" ");
1296
1297 for(int i=0; i<this.nItems; i++){
1298 fout.print(this.itemNames[i], fieldItemName);
1299 fout.print(Fmath.truncate(this.standardizedItemMinima[i], this.trunc), fieldItemNumber);
1300 fout.print(Fmath.truncate(this.standardizedItemMaxima[i], this.trunc), fieldItemNumber);
1301 fout.print(Fmath.truncate(this.standardizedItemMedians[i], this.trunc), fieldItemNumber);
1302 fout.print(Fmath.truncate(this.standardizedItemRanges[i], this.trunc), fieldItemNumber);
1303 fout.println(Fmath.truncate(this.standardizedItemTotals[i], this.trunc));
1304 }
1305 fout.println();
1306
1307
1308 fout.print("item", fieldItemSName);
1309 fout.print("mean", fieldItemNumber);
1310 fout.print("standard", fieldItemNumber);
1311 fout.print("variance", fieldItemNumber);
1312 fout.print("minimum", fieldItemNumber);
1313 fout.print("maximum", fieldItemNumber);
1314 fout.println("range");
1315 fout.print("statistic ", fieldItemSName);
1316 fout.print(" ", fieldItemNumber);
1317 fout.print("deviation", fieldItemNumber);
1318 fout.print(" ", fieldItemNumber);
1319 fout.print(" ", fieldItemNumber);
1320 fout.print(" ", fieldItemNumber);
1321 fout.print(" ", fieldItemNumber);
1322 fout.println(" ");
1323
1324 fout.print("item means", fieldItemSName);
1325 fout.print(Fmath.truncate(this.standardizedItemMeansMean, this.trunc), fieldItemNumber);
1326 fout.print(Fmath.truncate(this.standardizedItemMeansSd, this.trunc), fieldItemNumber);
1327 fout.print(Fmath.truncate(this.standardizedItemMeansVar, this.trunc), fieldItemNumber);
1328 fout.print(Fmath.truncate(this.standardizedItemMeansMin, this.trunc), fieldItemNumber);
1329 fout.print(Fmath.truncate(this.standardizedItemMeansMax, this.trunc), fieldItemNumber);
1330 fout.println(Fmath.truncate(this.standardizedItemMeansRange, this.trunc));
1331
1332 fout.print("item standard deviations", fieldItemSName);
1333 fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsMean, this.trunc), fieldItemNumber);
1334 fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsSd, this.trunc), fieldItemNumber);
1335 fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsVar, this.trunc), fieldItemNumber);
1336 fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsMin, this.trunc), fieldItemNumber);
1337 fout.print(Fmath.truncate(this.standardizedItemStandardDeviationsMax, this.trunc), fieldItemNumber);
1338 fout.println(Fmath.truncate(this.standardizedItemStandardDeviationsRange, this.trunc));
1339
1340 fout.print("item variances", fieldItemSName);
1341 fout.print(Fmath.truncate(this.standardizedItemVariancesMean, this.trunc), fieldItemNumber);
1342 fout.print(Fmath.truncate(this.standardizedItemVariancesSd, this.trunc), fieldItemNumber);
1343 fout.print(Fmath.truncate(this.standardizedItemVariancesVar, this.trunc), fieldItemNumber);
1344 fout.print(Fmath.truncate(this.standardizedItemVariancesMin, this.trunc), fieldItemNumber);
1345 fout.print(Fmath.truncate(this.standardizedItemVariancesMax, this.trunc), fieldItemNumber);
1346 fout.println(Fmath.truncate(this.standardizedItemVariancesRange, this.trunc));
1347
1348 fout.print("item mimima", fieldItemSName);
1349 fout.print(Fmath.truncate(this.standardizedItemMinimaMean, this.trunc), fieldItemNumber);
1350 fout.print(Fmath.truncate(this.standardizedItemMinimaSd, this.trunc), fieldItemNumber);
1351 fout.print(Fmath.truncate(this.standardizedItemMinimaVar, this.trunc), fieldItemNumber);
1352 fout.print(Fmath.truncate(this.standardizedItemMinimaMin, this.trunc), fieldItemNumber);
1353 fout.print(Fmath.truncate(this.standardizedItemMinimaMax, this.trunc), fieldItemNumber);
1354 fout.println(Fmath.truncate(this.standardizedItemMinimaRange, this.trunc));
1355
1356 fout.print("item maxima", fieldItemSName);
1357 fout.print(Fmath.truncate(this.standardizedItemMaximaMean, this.trunc), fieldItemNumber);
1358 fout.print(Fmath.truncate(this.standardizedItemMaximaSd, this.trunc), fieldItemNumber);
1359 fout.print(Fmath.truncate(this.standardizedItemMaximaVar, this.trunc), fieldItemNumber);
1360 fout.print(Fmath.truncate(this.standardizedItemMaximaMin, this.trunc), fieldItemNumber);
1361 fout.print(Fmath.truncate(this.standardizedItemMaximaMax, this.trunc), fieldItemNumber);
1362 fout.println(Fmath.truncate(this.standardizedItemMaximaRange, this.trunc));
1363
1364 fout.print("item medians", fieldItemSName);
1365 fout.print(Fmath.truncate(this.standardizedItemMediansMean, this.trunc), fieldItemNumber);
1366 fout.print(Fmath.truncate(this.standardizedItemMediansSd, this.trunc), fieldItemNumber);
1367 fout.print(Fmath.truncate(this.standardizedItemMediansVar, this.trunc), fieldItemNumber);
1368 fout.print(Fmath.truncate(this.standardizedItemMediansMin, this.trunc), fieldItemNumber);
1369 fout.print(Fmath.truncate(this.standardizedItemMediansMax, this.trunc), fieldItemNumber);
1370 fout.println(Fmath.truncate(this.standardizedItemMediansRange, this.trunc));
1371
1372 fout.print("item ranges", fieldItemSName);
1373 fout.print(Fmath.truncate(this.standardizedItemRangesMean, this.trunc), fieldItemNumber);
1374 fout.print(Fmath.truncate(this.standardizedItemRangesSd, this.trunc), fieldItemNumber);
1375 fout.print(Fmath.truncate(this.standardizedItemRangesVar, this.trunc), fieldItemNumber);
1376 fout.print(Fmath.truncate(this.standardizedItemRangesMin, this.trunc), fieldItemNumber);
1377 fout.print(Fmath.truncate(this.standardizedItemRangesMax, this.trunc), fieldItemNumber);
1378 fout.println(Fmath.truncate(this.standardizedItemRangesRange, this.trunc));
1379
1380 fout.print("item totals", fieldItemSName);
1381 fout.print(Fmath.truncate(this.standardizedItemTotalsMean, this.trunc), fieldItemNumber);
1382 fout.print(Fmath.truncate(this.standardizedItemTotalsSd, this.trunc), fieldItemNumber);
1383 fout.print(Fmath.truncate(this.standardizedItemTotalsVar, this.trunc), fieldItemNumber);
1384 fout.print(Fmath.truncate(this.standardizedItemTotalsMin, this.trunc), fieldItemNumber);
1385 fout.print(Fmath.truncate(this.standardizedItemTotalsMax, this.trunc), fieldItemNumber);
1386 fout.println(Fmath.truncate(this.standardizedItemTotalsRange, this.trunc));
1387
1388 fout.println();
1389
1390
1391 fout.println("DELETION OF ITEMS");
1392 int fieldDitem = 16;
1393 if(fieldItemName>fieldDitem)fieldDitem=fieldItemName;
1394
1395 fout.print(" ", fieldDitem);
1396 fout.print("Raw data", fieldItemNumber);
1397 fout.print(" ", fieldItemNumber);
1398 fout.print(" ", fieldItemNumber);
1399 fout.print(" ", fieldItemNumber);
1400 fout.println("Standardized data");
1401
1402 fout.print("Deleted item", fieldDitem);
1403 fout.print("Alpha", fieldItemNumber);
1404 fout.print("Correlation", fieldItemNumber);
1405 fout.print("Average", fieldItemNumber);
1406 fout.print("Average", fieldItemNumber);
1407
1408 fout.print("Alpha", fieldItemNumber);
1409 fout.print("Correlation", fieldItemNumber);
1410 fout.print("Average", fieldItemNumber);
1411 fout.println("Average");
1412
1413
1414 fout.print(" ", fieldDitem);
1415 fout.print(" ", fieldItemNumber);
1416 fout.print("coefficient", fieldItemNumber);
1417 fout.print("inter-item", fieldItemNumber);
1418 fout.print("inter-item", fieldItemNumber);
1419
1420 fout.print(" ", fieldItemNumber);
1421 fout.print("coefficient", fieldItemNumber);
1422 fout.print("inter-item", fieldItemNumber);
1423 fout.println("inter-item");
1424
1425
1426 fout.print(" ", fieldDitem);
1427 fout.print(" ", fieldItemNumber);
1428 fout.print("with total", fieldItemNumber);
1429 fout.print("correlation", fieldItemNumber);
1430 fout.print("correlation", fieldItemNumber);
1431
1432 fout.print(" ", fieldItemNumber);
1433 fout.print("with total", fieldItemNumber);
1434 fout.print("correlation", fieldItemNumber);
1435 fout.println("correlation");
1436
1437
1438 fout.print(" ", fieldDitem);
1439 fout.print(" ", fieldItemNumber);
1440 fout.print(" ", fieldItemNumber);
1441 fout.print("coefficient", fieldItemNumber);
1442 fout.print("coefficient", fieldItemNumber);
1443
1444 fout.print(" ", fieldItemNumber);
1445 fout.print(" ", fieldItemNumber);
1446 fout.print("coefficient", fieldItemNumber);
1447 fout.println("coefficient");
1448
1449
1450 fout.print(" ", fieldDitem);
1451 fout.print(" ", fieldItemNumber);
1452 fout.print(" ", fieldItemNumber);
1453 fout.print("without totals", fieldItemNumber);
1454 fout.print("with totals", fieldItemNumber);
1455
1456 fout.print(" ", fieldItemNumber);
1457 fout.print(" ", fieldItemNumber);
1458 fout.print("without totals", fieldItemNumber);
1459 fout.println("with totals");
1460
1461 double[] newRawAlpha = new double[this.nItems];
1462 double[] newStandardizedAlpha = new double[this.nItems];
1463 double[] newRawRho = new double[this.nItems];
1464 double[] newStandardizedRho = new double[this.nItems];
1465 for(int i=0; i<this.nItems; i++){
1466 int index = i+1;
1467 double[][] newScore1 = this.deleteItem(index);
1468 Cronbach cr = new Cronbach();
1469 cr.enterScoresAsRowPerPerson(newScore1);
1470 double rawAlphaD = cr.rawAlpha();
1471 newRawAlpha[i] = rawAlphaD;
1472 double rawMeanRhoWithTotalsD = cr.rawAverageCorrelationCoefficientsWithTotals();
1473 double[] rawPersonTotalsD = cr.rawPersonTotals();
1474 double rawRhoAgainstTotalsD = Stat.corrCoeff(rawPersonTotalsD, this.scores0[i]);
1475 double rawMeanRhoWithoutTotalsD = cr.rawAverageCorrelationCoefficients();
1476 newRawRho[i] = rawRhoAgainstTotalsD;
1477
1478 double standardizedAlphaD = cr.standardizedAlpha();
1479 newStandardizedAlpha[i] = standardizedAlphaD;
1480 double standardizedMeanRhoWithTotalsD = cr.standardizedAverageCorrelationCoefficients();
1481 double[] standardizedPersonTotalsD = cr.standardizedPersonTotals();
1482 double standardizedRhoAgainstTotalsD = Stat.corrCoeff(standardizedPersonTotalsD, this.scores0[i]);
1483 double standardizedMeanRhoWithoutTotalsD = cr.standardizedAverageCorrelationCoefficients();
1484 newStandardizedRho[i] = standardizedRhoAgainstTotalsD;
1485
1486 fout.print(this.itemNames[i], fieldDitem);
1487 fout.print(Fmath.truncate(rawAlphaD, trunc), fieldItemNumber);
1488 fout.print(Fmath.truncate(rawRhoAgainstTotalsD, trunc), fieldItemNumber);
1489 fout.print(Fmath.truncate(rawMeanRhoWithoutTotalsD, trunc), fieldItemNumber);
1490 fout.print(Fmath.truncate(rawMeanRhoWithTotalsD, trunc), fieldItemNumber);
1491
1492 fout.print(Fmath.truncate(standardizedAlphaD, trunc), fieldItemNumber);
1493 fout.print(Fmath.truncate(standardizedRhoAgainstTotalsD, trunc), fieldItemNumber);
1494 fout.print(Fmath.truncate(standardizedMeanRhoWithoutTotalsD, trunc), fieldItemNumber);
1495 fout.print(Fmath.truncate(standardizedMeanRhoWithTotalsD, trunc), fieldItemNumber);
1496 fout.println();
1497 }
1498 fout.println();
1499
1500 fout.print("No item deleted", fieldDitem);
1501 fout.print(Fmath.truncate(this.rawAlpha, trunc), fieldItemNumber);
1502 fout.print(" ", fieldItemNumber);
1503 fout.print(Fmath.truncate(this.rawMeanRhoWithoutTotals, trunc), fieldItemNumber);
1504 fout.print(Fmath.truncate(this.rawMeanRhoWithTotals, trunc), fieldItemNumber);
1505
1506 fout.print(Fmath.truncate(this.standardizedAlpha, trunc), fieldItemNumber);
1507 fout.print(" ", fieldItemNumber);
1508 fout.print(Fmath.truncate(this.standardizedMeanRhoWithoutTotals, trunc), fieldItemNumber);
1509 fout.println(Fmath.truncate(this.standardizedMeanRhoWithTotals, trunc));
1510 fout.println();
1511
1512 // output a deleted item data file
1513 this.deletedItemDataFile(newRawAlpha, newRawRho, newStandardizedAlpha, newStandardizedRho);
1514
1515 int fieldInd = 12;
1516 fout.println("INDIVIDUALS - raw data");
1517 fout.print("person", fieldInd);
1518 fout.print("mean", fieldItemNumber);
1519 fout.print("standard", fieldItemNumber);
1520 fout.print("minimum", fieldItemNumber);
1521 fout.print("maximum", fieldItemNumber);
1522 fout.print("range", fieldItemNumber);
1523 fout.println("total");
1524
1525 fout.print(" ", fieldInd);
1526 fout.print(" ", fieldItemNumber);
1527 fout.print("deviation", fieldItemNumber);
1528 fout.print(" ", fieldItemNumber);
1529 fout.print(" ", fieldItemNumber);
1530 fout.print(" ", fieldItemNumber);
1531 fout.println(" ");
1532
1533 int fieldScore = 0;
1534 for(int i=0; i<this.nItems; i++){
1535 for(int j=0; j<this.nPersons; j++){
1536 int sl = Double.toString(scores0[i][j]).length();
1537 if(sl>fieldScore)fieldScore = sl;
1538 }
1539 }
1540 fieldScore++;
1541 if(fieldScore<fieldItemName)fieldScore = fieldItemName;
1542 for(int i=0; i<this.nPersons; i++){
1543 fout.print((this.personIndices[i]+1), fieldInd);
1544 fout.print(Fmath.truncate(this.rawPersonMeans[i], this.trunc), fieldItemNumber);
1545 fout.print(Fmath.truncate(this.rawPersonStandardDeviations[i], this.trunc), fieldItemNumber);
1546 fout.print(Fmath.truncate(this.rawPersonMinima[i], this.trunc), fieldItemNumber);
1547 fout.print(Fmath.truncate(this.rawPersonMaxima[i], this.trunc), fieldItemNumber);
1548 fout.print(Fmath.truncate(this.rawPersonRanges[i], this.trunc), fieldItemNumber);
1549 fout.println(Fmath.truncate(this.rawPersonTotals[i], this.trunc));
1550 }
1551 fout.println();
1552
1553 fout.println("scores:");
1554 fout.print("person ", fieldInd);
1555 for(int i=0; i<this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
1556 fout.println();
1557
1558 for(int i=0; i<this.nPersons; i++){
1559 fout.print((this.personIndices[i]+1), fieldInd);
1560 for(int j=0; j<this.nItems; j++)fout.print(Fmath.truncate(this.scores1[i][j], this.trunc), fieldItemNumber);
1561 fout.println();
1562 }
1563 fout.println();
1564
1565 fout.println("INDIVIDUALS - standardized data");
1566 fout.print("person ", fieldInd);
1567 fout.print("mean", fieldItemNumber);
1568 fout.print("standard", fieldItemNumber);
1569 fout.print("minimum", fieldItemNumber);
1570 fout.print("maximum", fieldItemNumber);
1571 fout.print("range", fieldItemNumber);
1572 fout.println("total");
1573
1574
1575 fout.print(" ", fieldInd);
1576 fout.print(" ", fieldItemNumber);
1577 fout.print("deviation", fieldItemNumber);
1578 fout.print(" ", fieldItemNumber);
1579 fout.print(" ", fieldItemNumber);
1580 fout.print(" ", fieldItemNumber);
1581 fout.println(" ");
1582
1583 for(int i=0; i<this.nPersons; i++){
1584 fout.print((this.personIndices[i]+1), fieldInd);
1585 fout.print(Fmath.truncate(this.standardizedPersonMeans[i], this.trunc), fieldItemNumber);
1586 fout.print(Fmath.truncate(this.standardizedPersonStandardDeviations[i], this.trunc), fieldItemNumber);
1587 fout.print(Fmath.truncate(this.standardizedPersonMinima[i], this.trunc), fieldItemNumber);
1588 fout.print(Fmath.truncate(this.standardizedPersonMaxima[i], this.trunc), fieldItemNumber);
1589 fout.print(Fmath.truncate(this.standardizedPersonRanges[i], this.trunc), fieldItemNumber);
1590 fout.println(Fmath.truncate(this.standardizedPersonTotals[i], this.trunc));
1591 }
1592 fout.println();
1593
1594 fout.println("scores:");
1595 fout.print("person ", fieldInd);
1596 for(int i=0; i<this.nItems; i++)fout.print(this.itemNames[i], fieldItemNumber);
1597 fout.println();
1598
1599 for(int i=0; i<this.nPersons; i++){
1600 fout.print((this.personIndices[i]+1), fieldInd);
1601 for(int j=0; j<this.nItems; j++)fout.print(Fmath.truncate(this.standardizedScores1[i][j], trunc), fieldItemNumber);
1602 fout.println();
1603 }
1604 fout.println();
1605
1606 fout.println("ALL SCORES - raw data");
1607 fout.print("mean", fieldItemNumber);
1608 fout.print("standard", fieldItemNumber);
1609 fout.print("minimum", fieldItemNumber);
1610 fout.print("maximum", fieldItemNumber);
1611 fout.print("range", fieldItemNumber);
1612 fout.println("overall");
1613
1614 fout.print(" ", fieldItemNumber);
1615 fout.print("deviation", fieldItemNumber);
1616 fout.print(" ", fieldItemNumber);
1617 fout.print(" ", fieldItemNumber);
1618 fout.print(" ", fieldItemNumber);
1619 fout.println("total");
1620
1621 fout.print(Fmath.truncate(this.rawAllResponsesMean, this.trunc), fieldItemNumber);
1622 fout.print(Fmath.truncate(this.rawAllResponsesStandardDeviation, this.trunc), fieldItemNumber);
1623 fout.print(Fmath.truncate(this.rawAllResponsesMinimum, this.trunc), fieldItemNumber);
1624 fout.print(Fmath.truncate(this.rawAllResponsesMaximum, this.trunc), fieldItemNumber);
1625 fout.print(Fmath.truncate(this.rawAllResponsesRange, this.trunc), fieldItemNumber);
1626 fout.println(Fmath.truncate(this.rawAllResponsesTotal, this.trunc));
1627 fout.println();
1628
1629 fout.println("ALL SCORES - standardized data");
1630 fout.print("mean", fieldItemNumber);
1631 fout.print("standard", fieldItemNumber);
1632 fout.print("minimum", fieldItemNumber);
1633 fout.print("maximum", fieldItemNumber);
1634 fout.print("range", fieldItemNumber);
1635 fout.println("overall");
1636
1637 fout.print(" ", fieldItemNumber);
1638 fout.print("deviation", fieldItemNumber);
1639 fout.print(" ", fieldItemNumber);
1640 fout.print(" ", fieldItemNumber);
1641 fout.print(" ", fieldItemNumber);
1642 fout.println("total");
1643
1644 fout.print(Fmath.truncate(this.standardizedAllResponsesMean, this.trunc), fieldItemNumber);
1645 fout.print(Fmath.truncate(this.standardizedAllResponsesStandardDeviation, this.trunc), fieldItemNumber);
1646 fout.print(Fmath.truncate(this.standardizedAllResponsesMinimum, this.trunc), fieldItemNumber);
1647 fout.print(Fmath.truncate(this.standardizedAllResponsesMaximum, this.trunc), fieldItemNumber);
1648 fout.print(Fmath.truncate(this.standardizedAllResponsesRange, this.trunc), fieldItemNumber);
1649 fout.println(Fmath.truncate(this.standardizedAllResponsesTotal, this.trunc));
1650 fout.println();
1651
1652
1653 // close output file
1654 fout.close();
1655 }
1656
1657 // Creation of a data file facilitating a full analysis of the data minus the least consitent item
1658 private void deletedItemDataFile(double[] newRawAlpha, double[] newRawRho, double[] newStandardizedAlpha, double[] newStandardizedRho){
1659
1660 // Find maximum alpha and minimum correlation with totals
1661 ArrayMaths am = new ArrayMaths(newRawAlpha);
1662 int index1 = am.maximumIndex();
1663 am = new ArrayMaths(newStandardizedAlpha);
1664 int index2 = am.maximumIndex();
1665 am = new ArrayMaths(newRawRho);
1666 int index3 = am.minimumIndex();
1667 am = new ArrayMaths(newStandardizedRho);
1668 int index4 = am.minimumIndex();
1669
1670
1671 // majority voting on least consistent item
1672 this.deletedItemIndex = index3;
1673 if(index1==index2 && index1==index3 && index1==index4){
1674 this.deletedItemIndex = index1;
1675 }
1676 else{
1677 if(index1==index2 && (index1==index3 || index1==index4)){
1678 this.deletedItemIndex = index1;
1679 }
1680 else{
1681 if(index4==index3 && (index4==index1 || index4==index2)){
1682 this.deletedItemIndex = index4;
1683 }
1684 else{
1685 if(index1==index2 && index3==index4){
1686 this.deletedItemIndex = index3;
1687 }
1688 else{
1689 if(index1==index3 && index2==index4){
1690 this.deletedItemIndex = index1;
1691 }
1692 else{
1693 if(index1!=index2 && index2!=index3 && index3!=index4){
1694 this.deletedItemIndex = index3;
1695 }
1696 }
1697 }
1698 }
1699 }
1700 }
1701
1702 this.deletedFilename = null;
1703 if(this.inputFilename!=null){
1704 this.deletedFilename = this.inputFilename;
1705 int pos = this.deletedFilename.indexOf(".");
1706 if(pos!=-1)this.deletedFilename = this.deletedFilename.substring(0,pos);
1707 this.deletedFilename = this.deletedFilename + "_" + this.itemNames[this.deletedItemIndex]+"_deleted";
1708 this.deletedFilename = this.deletedFilename + ".txt";
1709 }
1710 else{
1711 this.deletedFilename = "DeletedItemFile.txt";
1712 }
1713
1714 FileOutput dfout = new FileOutput(this.deletedFilename);
1715 String newTitle = title[0] + " - Item " + this.itemNames[this.deletedItemIndex] + " deleted";
1716 dfout.println(newTitle);
1717 dfout.println((this.nItems-1));
1718 dfout.println(this.nPersons);
1719 for(int i=0; i<this.nItems; i++){
1720 if(i!=this.deletedItemIndex)dfout.printtab(this.itemNames[i]);
1721 }
1722 dfout.println();
1723 if(this.originalDataType==0){
1724 for(int i=0; i<this.nItems; i++){
1725 if(i!=this.deletedItemIndex){
1726 for(int j=0; j<this.nPersons; j++){
1727 dfout.printtab(this.scores0[i][j]);
1728 }
1729 dfout.println();
1730 }
1731 }
1732 }
1733 else{
1734 for(int j=0; j<this.nPersons; j++){
1735 for(int i=0; i<this.nItems; i++){
1736 if(i!=this.deletedItemIndex){
1737 dfout.printtab(this.scores1[j][i]);
1738 }
1739 }
1740 dfout.println();
1741 }
1742 }
1743 dfout.close();
1744 }
1745
1746 // Return deleted item new data file name
1747 public String getDeletionFileName(){
1748 return this.deletedFilename;
1749 }
1750
1751 // Return least consistent item name
1752 public String getLeastConsistentItemName(){
1753 return this.itemNames[this.deletedItemIndex];
1754 }
1755
1756
1757}
Note: See TracBrowser for help on using the repository browser.