R version 2.8.0 (2008-10-20) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- c(94.3,99.4,115.7,116.8,99.8,96,115.9,109.1,117.3,109.8,112.8,110.7,100,113.3,122.4,112.5,104.2,92.5,117.2,109.3,106.1,118.8,105.3,106,102,112.9,116.5,114.8,100.5,85.4,114.6,109.9,100.7,115.5,100.7,99,102.3,108.8,105.9,113.2,95.7,80.9,113.9,98.1,102.8,104.7,95.9,94.6,101.6,103.9,110.3,114.1,96.8,87.4,111.4,97.4,102.9,112.7,97,95.1) > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > n <- length(x) > c <- array(NA,dim=c(401)) > l <- array(NA,dim=c(401)) > mx <- 0 > mxli <- -999 > for (i in 1:401) + { + l[i] <- (i-201)/100 + if (l[i] != 0) + { + x1 <- (x^l[i] - 1) / l[i] + } else { + x1 <- log(x) + } + c[i] <- cor(qnorm(ppoints(x), mean=0, sd=1),x1) + if (mx < c[i]) + { + mx <- c[i] + mxli <- l[i] + } + } > c [1] -0.2440976 -0.2441703 -0.2442430 -0.2443156 -0.2443881 -0.2444605 [7] -0.2445328 -0.2446051 -0.2446772 -0.2447493 -0.2448213 -0.2448932 [13] -0.2449650 -0.2450368 -0.2451084 -0.2451800 -0.2452515 -0.2453228 [19] -0.2453942 -0.2454654 -0.2455365 -0.2456076 -0.2456785 -0.2457494 [25] -0.2458202 -0.2458909 -0.2459616 -0.2460321 -0.2461025 -0.2461729 [31] -0.2462432 -0.2463134 -0.2463835 -0.2464535 -0.2465235 -0.2465933 [37] -0.2466631 -0.2467328 -0.2468024 -0.2468719 -0.2469413 -0.2470107 [43] -0.2470799 -0.2471491 -0.2472182 -0.2472872 -0.2473561 -0.2474249 [49] -0.2474937 -0.2475623 -0.2476309 -0.2476994 -0.2477678 -0.2478361 [55] -0.2479043 -0.2479725 -0.2480405 -0.2481085 -0.2481764 -0.2482442 [61] -0.2483119 -0.2483796 -0.2484471 -0.2485146 -0.2485819 -0.2486492 [67] -0.2487164 -0.2487835 -0.2488506 -0.2489175 -0.2489844 -0.2490511 [73] -0.2491178 -0.2491844 -0.2492510 -0.2493174 -0.2493837 -0.2494500 [79] -0.2495162 -0.2495823 -0.2496483 -0.2497142 -0.2497800 -0.2498458 [85] -0.2499114 -0.2499770 -0.2500425 -0.2501079 -0.2501732 -0.2502385 [91] -0.2503036 -0.2503687 -0.2504337 -0.2504986 -0.2505634 -0.2506281 [97] -0.2506927 -0.2507573 -0.2508218 -0.2508861 -0.2509504 -0.2510147 [103] -0.2510788 -0.2511428 -0.2512068 -0.2512707 -0.2513344 -0.2513981 [109] -0.2514618 -0.2515253 -0.2515887 -0.2516521 -0.2517154 -0.2517786 [115] -0.2518417 -0.2519047 -0.2519676 -0.2520305 -0.2520933 -0.2521560 [121] -0.2522186 -0.2522811 -0.2523435 -0.2524058 -0.2524681 -0.2525303 [127] -0.2525924 -0.2526544 -0.2527163 -0.2527781 -0.2528399 -0.2529016 [133] -0.2529631 -0.2530246 -0.2530861 -0.2531474 -0.2532086 -0.2532698 [139] -0.2533309 -0.2533919 -0.2534528 -0.2535136 -0.2535744 -0.2536350 [145] -0.2536956 -0.2537561 -0.2538165 -0.2538768 -0.2539371 -0.2539972 [151] -0.2540573 -0.2541173 -0.2541772 -0.2542370 -0.2542967 -0.2543564 [157] -0.2544160 -0.2544754 -0.2545348 -0.2545942 -0.2546534 -0.2547126 [163] -0.2547716 -0.2548306 -0.2548895 -0.2549483 -0.2550071 -0.2550657 [169] -0.2551243 -0.2551828 -0.2552412 -0.2552995 -0.2553577 -0.2554159 [175] -0.2554740 -0.2555320 -0.2555899 -0.2556477 -0.2557054 -0.2557631 [181] -0.2558207 -0.2558782 -0.2559356 -0.2559929 -0.2560502 -0.2561073 [187] -0.2561644 -0.2562214 -0.2562783 -0.2563352 -0.2563919 -0.2564486 [193] -0.2565052 -0.2565617 -0.2566181 -0.2566745 -0.2567307 -0.2567869 [199] -0.2568430 -0.2568990 -0.2569549 -0.2570108 -0.2570666 -0.2571223 [205] -0.2571779 -0.2572334 -0.2572889 -0.2573442 -0.2573995 -0.2574547 [211] -0.2575098 -0.2575649 -0.2576198 -0.2576747 -0.2577295 -0.2577842 [217] -0.2578389 -0.2578934 -0.2579479 -0.2580023 -0.2580566 -0.2581108 [223] -0.2581650 -0.2582191 -0.2582731 -0.2583270 -0.2583808 -0.2584346 [229] -0.2584882 -0.2585418 -0.2585953 -0.2586488 -0.2587021 -0.2587554 [235] -0.2588086 -0.2588617 -0.2589147 -0.2589677 -0.2590206 -0.2590734 [241] -0.2591261 -0.2591787 -0.2592313 -0.2592837 -0.2593361 -0.2593885 [247] -0.2594407 -0.2594929 -0.2595450 -0.2595970 -0.2596489 -0.2597007 [253] -0.2597525 -0.2598042 -0.2598558 -0.2599073 -0.2599588 -0.2600102 [259] -0.2600614 -0.2601127 -0.2601638 -0.2602149 -0.2602659 -0.2603168 [265] -0.2603676 -0.2604183 -0.2604690 -0.2605196 -0.2605701 -0.2606206 [271] -0.2606709 -0.2607212 -0.2607714 -0.2608215 -0.2608716 -0.2609216 [277] -0.2609715 -0.2610213 -0.2610710 -0.2611207 -0.2611703 -0.2612198 [283] -0.2612692 -0.2613186 -0.2613679 -0.2614171 -0.2614662 -0.2615153 [289] -0.2615642 -0.2616132 -0.2616620 -0.2617107 -0.2617594 -0.2618080 [295] -0.2618565 -0.2619050 -0.2619533 -0.2620016 -0.2620498 -0.2620980 [301] -0.2621460 -0.2621940 -0.2622419 -0.2622898 -0.2623375 -0.2623852 [307] -0.2624328 -0.2624804 -0.2625278 -0.2625752 -0.2626225 -0.2626698 [313] -0.2627170 -0.2627640 -0.2628111 -0.2628580 -0.2629049 -0.2629517 [319] -0.2629984 -0.2630450 -0.2630916 -0.2631381 -0.2631845 -0.2632308 [325] -0.2632771 -0.2633233 -0.2633694 -0.2634155 -0.2634615 -0.2635074 [331] -0.2635532 -0.2635989 -0.2636446 -0.2636902 -0.2637358 -0.2637812 [337] -0.2638266 -0.2638719 -0.2639172 -0.2639624 -0.2640075 -0.2640525 [343] -0.2640974 -0.2641423 -0.2641871 -0.2642319 -0.2642765 -0.2643211 [349] -0.2643656 -0.2644101 -0.2644545 -0.2644988 -0.2645430 -0.2645872 [355] -0.2646312 -0.2646753 -0.2647192 -0.2647631 -0.2648069 -0.2648506 [361] -0.2648943 -0.2649378 -0.2649814 -0.2650248 -0.2650682 -0.2651115 [367] -0.2651547 -0.2651979 -0.2652410 -0.2652840 -0.2653269 -0.2653698 [373] -0.2654126 -0.2654553 -0.2654980 -0.2655406 -0.2655831 -0.2656256 [379] -0.2656680 -0.2657103 -0.2657525 -0.2657947 -0.2658368 -0.2658788 [385] -0.2659208 -0.2659627 -0.2660045 -0.2660463 -0.2660880 -0.2661296 [391] -0.2661712 -0.2662126 -0.2662541 -0.2662954 -0.2663367 -0.2663779 [397] -0.2664190 -0.2664601 -0.2665011 -0.2665420 -0.2665829 > mx [1] 0 > mxli [1] -999 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/freestat/rcomp/tmp/1jqy41257793712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Normality Plot',xlab='Lambda',ylab='correlation') > mtext(paste('Optimal Lambda =',mxli)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/273s71257793712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x,main='Histogram of Original Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/3wcdx1257793712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(x1,main='Histogram of Transformed Data',xlab='X',ylab='frequency') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/41y1s1257793712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x) > qqline(x) > grid() > mtext('Original Data') > dev.off() null device 1 > postscript(file="/var/www/html/freestat/rcomp/tmp/5a49m1257793712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(x1) > qqline(x1) > grid() > mtext('Transformed Data') > dev.off() null device 1 > > #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,'Box-Cox Normality Plot',2,TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'# observations x',header=TRUE) > a<-table.element(a,n) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'maximum correlation',header=TRUE) > a<-table.element(a,mx) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'optimal lambda',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/freestat/rcomp/tmp/61qe51257793712.tab") > > system("convert tmp/1jqy41257793712.ps tmp/1jqy41257793712.png") > system("convert tmp/273s71257793712.ps tmp/273s71257793712.png") > system("convert tmp/3wcdx1257793712.ps tmp/3wcdx1257793712.png") > system("convert tmp/41y1s1257793712.ps tmp/41y1s1257793712.png") > system("convert tmp/5a49m1257793712.ps tmp/5a49m1257793712.png") > > > proc.time() user system elapsed 1.715 1.263 1.973