R version 2.9.0 (2009-04-17) Copyright (C) 2009 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(95.1,97,112.7,102.9,97.4,111.4,87.4,96.8,114.1,110.3,103.9,101.6,94.6,95.9,104.7,102.8,98.1,113.9,80.9,95.7,113.2,105.9,108.8,102.3,99,100.7,115.5,100.7,109.9,114.6,85.4,100.5,114.8,116.5,112.9,102,106,105.3,118.8,106.1,109.3,117.2,92.5,104.2,112.5,122.4,113.3,100,110.7,112.8,109.8,117.3,109.1,115.9,96,99.8,116.8,115.7,99.4,94.3) > #'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 0.2445328 [8] 0.2446051 0.2446772 0.2447493 0.2448213 0.2448932 0.2449650 0.2450368 [15] 0.2451084 0.2451800 0.2452515 0.2453228 0.2453942 0.2454654 0.2455365 [22] 0.2456076 0.2456785 0.2457494 0.2458202 0.2458909 0.2459616 0.2460321 [29] 0.2461025 0.2461729 0.2462432 0.2463134 0.2463835 0.2464535 0.2465235 [36] 0.2465933 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 0.2474937 [50] 0.2475623 0.2476309 0.2476994 0.2477678 0.2478361 0.2479043 0.2479725 [57] 0.2480405 0.2481085 0.2481764 0.2482442 0.2483119 0.2483796 0.2484471 [64] 0.2485146 0.2485819 0.2486492 0.2487164 0.2487835 0.2488506 0.2489175 [71] 0.2489844 0.2490511 0.2491178 0.2491844 0.2492510 0.2493174 0.2493837 [78] 0.2494500 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 0.2503036 [92] 0.2503687 0.2504337 0.2504986 0.2505634 0.2506281 0.2506927 0.2507573 [99] 0.2508218 0.2508861 0.2509504 0.2510147 0.2510788 0.2511428 0.2512068 [106] 0.2512707 0.2513344 0.2513981 0.2514618 0.2515253 0.2515887 0.2516521 [113] 0.2517154 0.2517786 0.2518417 0.2519047 0.2519676 0.2520305 0.2520933 [120] 0.2521560 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 0.2529631 [134] 0.2530246 0.2530861 0.2531474 0.2532086 0.2532698 0.2533309 0.2533919 [141] 0.2534528 0.2535136 0.2535744 0.2536350 0.2536956 0.2537561 0.2538165 [148] 0.2538768 0.2539371 0.2539972 0.2540573 0.2541173 0.2541772 0.2542370 [155] 0.2542967 0.2543564 0.2544160 0.2544754 0.2545348 0.2545942 0.2546534 [162] 0.2547126 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 0.2554740 [176] 0.2555320 0.2555899 0.2556477 0.2557054 0.2557631 0.2558207 0.2558782 [183] 0.2559356 0.2559929 0.2560502 0.2561073 0.2561644 0.2562214 0.2562783 [190] 0.2563352 0.2563919 0.2564486 0.2565052 0.2565617 0.2566181 0.2566745 [197] 0.2567307 0.2567869 0.2568430 0.2568990 0.2569549 0.2570108 0.2570666 [204] 0.2571223 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 0.2578389 [218] 0.2578934 0.2579479 0.2580023 0.2580566 0.2581108 0.2581650 0.2582191 [225] 0.2582731 0.2583270 0.2583808 0.2584346 0.2584882 0.2585418 0.2585953 [232] 0.2586488 0.2587021 0.2587554 0.2588086 0.2588617 0.2589147 0.2589677 [239] 0.2590206 0.2590734 0.2591261 0.2591787 0.2592313 0.2592837 0.2593361 [246] 0.2593885 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 0.2600614 [260] 0.2601127 0.2601638 0.2602149 0.2602659 0.2603168 0.2603676 0.2604183 [267] 0.2604690 0.2605196 0.2605701 0.2606206 0.2606709 0.2607212 0.2607714 [274] 0.2608215 0.2608716 0.2609216 0.2609715 0.2610213 0.2610710 0.2611207 [281] 0.2611703 0.2612198 0.2612692 0.2613186 0.2613679 0.2614171 0.2614662 [288] 0.2615153 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 0.2621460 [302] 0.2621940 0.2622419 0.2622898 0.2623375 0.2623852 0.2624328 0.2624804 [309] 0.2625278 0.2625752 0.2626225 0.2626698 0.2627170 0.2627640 0.2628111 [316] 0.2628580 0.2629049 0.2629517 0.2629984 0.2630450 0.2630916 0.2631381 [323] 0.2631845 0.2632308 0.2632771 0.2633233 0.2633694 0.2634155 0.2634615 [330] 0.2635074 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 0.2640974 [344] 0.2641423 0.2641871 0.2642319 0.2642765 0.2643211 0.2643656 0.2644101 [351] 0.2644545 0.2644988 0.2645430 0.2645872 0.2646312 0.2646753 0.2647192 [358] 0.2647631 0.2648069 0.2648506 0.2648943 0.2649378 0.2649814 0.2650248 [365] 0.2650682 0.2651115 0.2651547 0.2651979 0.2652410 0.2652840 0.2653269 [372] 0.2653698 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 0.2659208 [386] 0.2659627 0.2660045 0.2660463 0.2660880 0.2661296 0.2661712 0.2662126 [393] 0.2662541 0.2662954 0.2663367 0.2663779 0.2664190 0.2664601 0.2665011 [400] 0.2665420 0.2665829 > mx [1] 0.2665829 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > postscript(file="/var/www/html/rcomp/tmp/1zfzw1261603592.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/2y2ux1261603592.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/3yo3d1261603592.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/40ira1261603592.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/5346z1261603592.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/6tboc1261603592.tab") > > try(system("convert tmp/1zfzw1261603592.ps tmp/1zfzw1261603592.png",intern=TRUE)) character(0) > try(system("convert tmp/2y2ux1261603592.ps tmp/2y2ux1261603592.png",intern=TRUE)) character(0) > try(system("convert tmp/3yo3d1261603592.ps tmp/3yo3d1261603592.png",intern=TRUE)) character(0) > try(system("convert tmp/40ira1261603592.ps tmp/40ira1261603592.png",intern=TRUE)) character(0) > try(system("convert tmp/5346z1261603592.ps tmp/5346z1261603592.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 1.101 0.796 1.718