R version 2.7.2 (2008-08-25) 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(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,111.8,112.5,116.3,110.3,117.1,103.4,96.2) > #'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.2651076 0.2651555 0.2652034 0.2652513 0.2652991 0.2653469 0.2653947 [8] 0.2654424 0.2654901 0.2655377 0.2655854 0.2656329 0.2656805 0.2657280 [15] 0.2657755 0.2658230 0.2658704 0.2659178 0.2659651 0.2660125 0.2660597 [22] 0.2661070 0.2661542 0.2662014 0.2662486 0.2662957 0.2663428 0.2663898 [29] 0.2664368 0.2664838 0.2665308 0.2665777 0.2666246 0.2666714 0.2667182 [36] 0.2667650 0.2668118 0.2668585 0.2669051 0.2669518 0.2669984 0.2670450 [43] 0.2670915 0.2671380 0.2671845 0.2672310 0.2672774 0.2673237 0.2673701 [50] 0.2674164 0.2674627 0.2675089 0.2675551 0.2676013 0.2676474 0.2676935 [57] 0.2677396 0.2677856 0.2678316 0.2678776 0.2679235 0.2679695 0.2680153 [64] 0.2680612 0.2681070 0.2681527 0.2681984 0.2682441 0.2682898 0.2683354 [71] 0.2683810 0.2684266 0.2684721 0.2685176 0.2685631 0.2686085 0.2686539 [78] 0.2686993 0.2687446 0.2687899 0.2688351 0.2688804 0.2689255 0.2689707 [85] 0.2690158 0.2690609 0.2691060 0.2691510 0.2691960 0.2692409 0.2692858 [92] 0.2693307 0.2693756 0.2694204 0.2694651 0.2695099 0.2695546 0.2695993 [99] 0.2696439 0.2696885 0.2697331 0.2697777 0.2698222 0.2698666 0.2699111 [106] 0.2699555 0.2699999 0.2700442 0.2700885 0.2701328 0.2701770 0.2702212 [113] 0.2702654 0.2703095 0.2703536 0.2703977 0.2704417 0.2704857 0.2705297 [120] 0.2705736 0.2706175 0.2706613 0.2707052 0.2707489 0.2707927 0.2708364 [127] 0.2708801 0.2709238 0.2709674 0.2710110 0.2710545 0.2710981 0.2711415 [134] 0.2711850 0.2712284 0.2712718 0.2713151 0.2713584 0.2714017 0.2714450 [141] 0.2714882 0.2715314 0.2715745 0.2716176 0.2716607 0.2717037 0.2717467 [148] 0.2717897 0.2718326 0.2718755 0.2719184 0.2719612 0.2720040 0.2720468 [155] 0.2720895 0.2721322 0.2721749 0.2722175 0.2722601 0.2723027 0.2723452 [162] 0.2723877 0.2724302 0.2724726 0.2725150 0.2725574 0.2725997 0.2726420 [169] 0.2726842 0.2727264 0.2727686 0.2728108 0.2728529 0.2728950 0.2729370 [176] 0.2729790 0.2730210 0.2730630 0.2731049 0.2731468 0.2731886 0.2732304 [183] 0.2732722 0.2733139 0.2733556 0.2733973 0.2734389 0.2734805 0.2735221 [190] 0.2735637 0.2736052 0.2736466 0.2736881 0.2737295 0.2737708 0.2738121 [197] 0.2738534 0.2738947 0.2739359 0.2739771 0.2740183 0.2740594 0.2741005 [204] 0.2741416 0.2741826 0.2742236 0.2742645 0.2743055 0.2743463 0.2743872 [211] 0.2744280 0.2744688 0.2745095 0.2745503 0.2745909 0.2746316 0.2746722 [218] 0.2747128 0.2747533 0.2747938 0.2748343 0.2748747 0.2749152 0.2749555 [225] 0.2749959 0.2750362 0.2750764 0.2751167 0.2751569 0.2751971 0.2752372 [232] 0.2752773 0.2753174 0.2753574 0.2753974 0.2754373 0.2754773 0.2755172 [239] 0.2755570 0.2755969 0.2756367 0.2756764 0.2757161 0.2757558 0.2757955 [246] 0.2758351 0.2758747 0.2759142 0.2759538 0.2759933 0.2760327 0.2760721 [253] 0.2761115 0.2761509 0.2761902 0.2762294 0.2762687 0.2763079 0.2763471 [260] 0.2763862 0.2764253 0.2764644 0.2765035 0.2765425 0.2765814 0.2766204 [267] 0.2766593 0.2766982 0.2767370 0.2767758 0.2768146 0.2768533 0.2768920 [274] 0.2769307 0.2769693 0.2770079 0.2770465 0.2770850 0.2771235 0.2771620 [281] 0.2772004 0.2772388 0.2772771 0.2773155 0.2773538 0.2773920 0.2774303 [288] 0.2774684 0.2775066 0.2775447 0.2775828 0.2776209 0.2776589 0.2776969 [295] 0.2777348 0.2777727 0.2778106 0.2778485 0.2778863 0.2779241 0.2779618 [302] 0.2779995 0.2780372 0.2780749 0.2781125 0.2781501 0.2781876 0.2782251 [309] 0.2782626 0.2783000 0.2783374 0.2783748 0.2784122 0.2784495 0.2784867 [316] 0.2785240 0.2785612 0.2785984 0.2786355 0.2786726 0.2787097 0.2787467 [323] 0.2787837 0.2788207 0.2788576 0.2788945 0.2789314 0.2789682 0.2790050 [330] 0.2790418 0.2790785 0.2791152 0.2791519 0.2791885 0.2792251 0.2792617 [337] 0.2792982 0.2793347 0.2793711 0.2794076 0.2794440 0.2794803 0.2795166 [344] 0.2795529 0.2795892 0.2796254 0.2796616 0.2796978 0.2797339 0.2797700 [351] 0.2798060 0.2798421 0.2798780 0.2799140 0.2799499 0.2799858 0.2800217 [358] 0.2800575 0.2800933 0.2801290 0.2801647 0.2802004 0.2802361 0.2802717 [365] 0.2803073 0.2803428 0.2803783 0.2804138 0.2804493 0.2804847 0.2805201 [372] 0.2805554 0.2805907 0.2806260 0.2806612 0.2806965 0.2807316 0.2807668 [379] 0.2808019 0.2808370 0.2808720 0.2809070 0.2809420 0.2809769 0.2810119 [386] 0.2810467 0.2810816 0.2811164 0.2811512 0.2811859 0.2812206 0.2812553 [393] 0.2812899 0.2813245 0.2813591 0.2813937 0.2814282 0.2814626 0.2814971 [400] 0.2815315 0.2815659 > mx [1] 0.2815659 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1tfod1226520347.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/2m2e81226520347.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/3hi6w1226520347.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/4atzm1226520347.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/5fr6m1226520347.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/6e5sv1226520347.tab") > > system("convert tmp/1tfod1226520347.ps tmp/1tfod1226520347.png") > system("convert tmp/2m2e81226520347.ps tmp/2m2e81226520347.png") > system("convert tmp/3hi6w1226520347.ps tmp/3hi6w1226520347.png") > system("convert tmp/4atzm1226520347.ps tmp/4atzm1226520347.png") > system("convert tmp/5fr6m1226520347.ps tmp/5fr6m1226520347.png") > > > proc.time() user system elapsed 1.345 0.812 1.752