R version 2.7.0 (2008-04-22) 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(103.1,100.6,103.1,95.5,90.5,90.9,88.8,90.7,94.3,104.6,111.1,110.8,107.2,99,99,91,96.2,96.9,96.2,100.1,99,115.4,106.9,107.1,99.3,99.2,108.3,105.6,99.5,107.4,93.1,88.1,110.7,113.1,99.6,93.6,98.6,99.6,114.3,107.8,101.2,112.5,100.5,93.9,116.2,112,106.4,95.7,96,95.8,103,102.2,98.4,111.4,86.6,91.3,107.9,101.8,104.4,93.4,100.1,98.5,112.9,101.4,107.1,110.8,90.3,95.5,111.4,113,107.5,95.9,106.3,105.2,117.2,106.9,108.2,113,97.2,99.9,108.1,118.1,109.1,93.3,112.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.2776534 0.2776964 0.2777393 0.2777823 0.2778252 0.2778680 0.2779108 [8] 0.2779536 0.2779964 0.2780391 0.2780818 0.2781245 0.2781671 0.2782097 [15] 0.2782522 0.2782947 0.2783372 0.2783796 0.2784220 0.2784644 0.2785067 [22] 0.2785490 0.2785913 0.2786335 0.2786757 0.2787179 0.2787600 0.2788021 [29] 0.2788441 0.2788861 0.2789281 0.2789701 0.2790120 0.2790539 0.2790957 [36] 0.2791375 0.2791793 0.2792210 0.2792627 0.2793043 0.2793460 0.2793876 [43] 0.2794291 0.2794706 0.2795121 0.2795535 0.2795950 0.2796363 0.2796777 [50] 0.2797190 0.2797602 0.2798015 0.2798426 0.2798838 0.2799249 0.2799660 [57] 0.2800071 0.2800481 0.2800890 0.2801300 0.2801709 0.2802118 0.2802526 [64] 0.2802934 0.2803341 0.2803749 0.2804155 0.2804562 0.2804968 0.2805374 [71] 0.2805779 0.2806184 0.2806589 0.2806993 0.2807397 0.2807801 0.2808204 [78] 0.2808607 0.2809009 0.2809411 0.2809813 0.2810215 0.2810616 0.2811016 [85] 0.2811417 0.2811816 0.2812216 0.2812615 0.2813014 0.2813412 0.2813811 [92] 0.2814208 0.2814606 0.2815003 0.2815399 0.2815795 0.2816191 0.2816587 [99] 0.2816982 0.2817377 0.2817771 0.2818165 0.2818559 0.2818952 0.2819345 [106] 0.2819738 0.2820130 0.2820521 0.2820913 0.2821304 0.2821695 0.2822085 [113] 0.2822475 0.2822864 0.2823254 0.2823642 0.2824031 0.2824419 0.2824807 [120] 0.2825194 0.2825581 0.2825968 0.2826354 0.2826740 0.2827125 0.2827510 [127] 0.2827895 0.2828279 0.2828663 0.2829047 0.2829430 0.2829813 0.2830195 [134] 0.2830577 0.2830959 0.2831340 0.2831721 0.2832102 0.2832482 0.2832862 [141] 0.2833241 0.2833620 0.2833999 0.2834377 0.2834755 0.2835133 0.2835510 [148] 0.2835887 0.2836263 0.2836639 0.2837015 0.2837390 0.2837765 0.2838140 [155] 0.2838514 0.2838888 0.2839261 0.2839634 0.2840007 0.2840379 0.2840751 [162] 0.2841122 0.2841493 0.2841864 0.2842235 0.2842604 0.2842974 0.2843343 [169] 0.2843712 0.2844081 0.2844449 0.2844816 0.2845184 0.2845551 0.2845917 [176] 0.2846283 0.2846649 0.2847014 0.2847379 0.2847744 0.2848108 0.2848472 [183] 0.2848836 0.2849199 0.2849561 0.2849924 0.2850286 0.2850647 0.2851008 [190] 0.2851369 0.2851729 0.2852089 0.2852449 0.2852808 0.2853167 0.2853526 [197] 0.2853884 0.2854241 0.2854599 0.2854956 0.2855312 0.2855668 0.2856024 [204] 0.2856379 0.2856734 0.2857089 0.2857443 0.2857797 0.2858151 0.2858504 [211] 0.2858856 0.2859209 0.2859561 0.2859912 0.2860263 0.2860614 0.2860964 [218] 0.2861314 0.2861664 0.2862013 0.2862362 0.2862710 0.2863058 0.2863406 [225] 0.2863753 0.2864100 0.2864446 0.2864792 0.2865138 0.2865483 0.2865828 [232] 0.2866173 0.2866517 0.2866861 0.2867204 0.2867547 0.2867889 0.2868232 [239] 0.2868573 0.2868915 0.2869256 0.2869596 0.2869937 0.2870276 0.2870616 [246] 0.2870955 0.2871294 0.2871632 0.2871970 0.2872307 0.2872644 0.2872981 [253] 0.2873317 0.2873653 0.2873989 0.2874324 0.2874658 0.2874993 0.2875327 [260] 0.2875660 0.2875993 0.2876326 0.2876658 0.2876990 0.2877322 0.2877653 [267] 0.2877984 0.2878314 0.2878644 0.2878974 0.2879303 0.2879632 0.2879960 [274] 0.2880289 0.2880616 0.2880943 0.2881270 0.2881597 0.2881923 0.2882248 [281] 0.2882574 0.2882899 0.2883223 0.2883547 0.2883871 0.2884194 0.2884517 [288] 0.2884839 0.2885162 0.2885483 0.2885805 0.2886126 0.2886446 0.2886766 [295] 0.2887086 0.2887405 0.2887724 0.2888043 0.2888361 0.2888679 0.2888996 [302] 0.2889313 0.2889629 0.2889946 0.2890261 0.2890577 0.2890892 0.2891206 [309] 0.2891520 0.2891834 0.2892148 0.2892461 0.2892773 0.2893085 0.2893397 [316] 0.2893708 0.2894019 0.2894330 0.2894640 0.2894950 0.2895259 0.2895568 [323] 0.2895877 0.2896185 0.2896493 0.2896800 0.2897107 0.2897414 0.2897720 [330] 0.2898026 0.2898332 0.2898637 0.2898941 0.2899245 0.2899549 0.2899853 [337] 0.2900156 0.2900458 0.2900760 0.2901062 0.2901364 0.2901665 0.2901965 [344] 0.2902266 0.2902565 0.2902865 0.2903164 0.2903462 0.2903761 0.2904058 [351] 0.2904356 0.2904653 0.2904949 0.2905246 0.2905542 0.2905837 0.2906132 [358] 0.2906427 0.2906721 0.2907015 0.2907308 0.2907601 0.2907894 0.2908186 [365] 0.2908478 0.2908769 0.2909060 0.2909351 0.2909641 0.2909931 0.2910220 [372] 0.2910509 0.2910798 0.2911086 0.2911374 0.2911661 0.2911948 0.2912235 [379] 0.2912521 0.2912807 0.2913092 0.2913377 0.2913662 0.2913946 0.2914230 [386] 0.2914513 0.2914796 0.2915079 0.2915361 0.2915643 0.2915924 0.2916205 [393] 0.2916485 0.2916766 0.2917045 0.2917325 0.2917604 0.2917882 0.2918160 [400] 0.2918438 0.2918716 > mx [1] 0.2918716 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/16wlx1226428249.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/rcomp/tmp/208qx1226428249.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/rcomp/tmp/3n45s1226428249.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/rcomp/tmp/4idlj1226428249.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/rcomp/tmp/5qq6d1226428249.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/6dhfa1226428249.tab") > > system("convert tmp/16wlx1226428249.ps tmp/16wlx1226428249.png") > system("convert tmp/208qx1226428249.ps tmp/208qx1226428249.png") > system("convert tmp/3n45s1226428249.ps tmp/3n45s1226428249.png") > system("convert tmp/4idlj1226428249.ps tmp/4idlj1226428249.png") > system("convert tmp/5qq6d1226428249.ps tmp/5qq6d1226428249.png") > > > proc.time() user system elapsed 2.441 1.350 2.610