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. > y <- c(100.0,93.5,88.2,89.2,91.4,92.5,91.4,88.2,87.1,84.9,92.5,93.5,93.5,91.4,90.3,91.4,93.5,93.5,92.5,91.4,89.2,86.0,88.2,87.1,87.1,86.0,84.9,84.9,86.0,86.0,84.9,86.0,82.8,77.4,80.6,78.5,75.3,75.3,75.3,77.4,78.5,76.3,73.1,68.8,65.6,69.9,82.8,84.9,80.6,74.2,71.0,74.2,82.8,86.0,86.0,82.8,78.5,79.6,87.1,89.2) > x <- c(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,91,93.2,103.1,94.1,91.8,102.7,82.6,89.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(x1,y) + if (mx < abs(c[i])) + { + mx <- abs(c[i]) + mxli <- l[i] + } + } > c [1] -0.2462920 -0.2463522 -0.2464124 -0.2464725 -0.2465326 -0.2465927 [7] -0.2466527 -0.2467128 -0.2467728 -0.2468328 -0.2468928 -0.2469527 [13] -0.2470127 -0.2470726 -0.2471325 -0.2471924 -0.2472523 -0.2473121 [19] -0.2473719 -0.2474317 -0.2474915 -0.2475513 -0.2476110 -0.2476707 [25] -0.2477304 -0.2477901 -0.2478497 -0.2479094 -0.2479690 -0.2480286 [31] -0.2480881 -0.2481477 -0.2482072 -0.2482667 -0.2483262 -0.2483857 [37] -0.2484451 -0.2485045 -0.2485639 -0.2486233 -0.2486826 -0.2487420 [43] -0.2488013 -0.2488606 -0.2489198 -0.2489791 -0.2490383 -0.2490975 [49] -0.2491566 -0.2492158 -0.2492749 -0.2493340 -0.2493931 -0.2494522 [55] -0.2495112 -0.2495702 -0.2496292 -0.2496882 -0.2497471 -0.2498060 [61] -0.2498649 -0.2499238 -0.2499827 -0.2500415 -0.2501003 -0.2501591 [67] -0.2502178 -0.2502766 -0.2503353 -0.2503940 -0.2504526 -0.2505113 [73] -0.2505699 -0.2506285 -0.2506870 -0.2507456 -0.2508041 -0.2508626 [79] -0.2509210 -0.2509795 -0.2510379 -0.2510963 -0.2511547 -0.2512130 [85] -0.2512713 -0.2513296 -0.2513879 -0.2514461 -0.2515043 -0.2515625 [91] -0.2516207 -0.2516789 -0.2517370 -0.2517951 -0.2518531 -0.2519112 [97] -0.2519692 -0.2520272 -0.2520852 -0.2521431 -0.2522010 -0.2522589 [103] -0.2523168 -0.2523746 -0.2524324 -0.2524902 -0.2525480 -0.2526057 [109] -0.2526634 -0.2527211 -0.2527787 -0.2528364 -0.2528940 -0.2529515 [115] -0.2530091 -0.2530666 -0.2531241 -0.2531816 -0.2532390 -0.2532964 [121] -0.2533538 -0.2534112 -0.2534685 -0.2535258 -0.2535831 -0.2536404 [127] -0.2536976 -0.2537548 -0.2538120 -0.2538691 -0.2539262 -0.2539833 [133] -0.2540404 -0.2540974 -0.2541545 -0.2542114 -0.2542684 -0.2543253 [139] -0.2543822 -0.2544391 -0.2544959 -0.2545527 -0.2546095 -0.2546663 [145] -0.2547230 -0.2547797 -0.2548364 -0.2548931 -0.2549497 -0.2550063 [151] -0.2550628 -0.2551194 -0.2551759 -0.2552324 -0.2552888 -0.2553452 [157] -0.2554016 -0.2554580 -0.2555143 -0.2555706 -0.2556269 -0.2556832 [163] -0.2557394 -0.2557956 -0.2558517 -0.2559079 -0.2559640 -0.2560201 [169] -0.2560761 -0.2561321 -0.2561881 -0.2562441 -0.2563000 -0.2563559 [175] -0.2564118 -0.2564676 -0.2565234 -0.2565792 -0.2566350 -0.2566907 [181] -0.2567464 -0.2568021 -0.2568577 -0.2569133 -0.2569689 -0.2570244 [187] -0.2570799 -0.2571354 -0.2571909 -0.2572463 -0.2573017 -0.2573571 [193] -0.2574124 -0.2574677 -0.2575230 -0.2575783 -0.2576335 -0.2576887 [199] -0.2577438 -0.2577989 -0.2578540 -0.2579091 -0.2579641 -0.2580191 [205] -0.2580741 -0.2581291 -0.2581840 -0.2582389 -0.2582937 -0.2583485 [211] -0.2584033 -0.2584581 -0.2585128 -0.2585675 -0.2586222 -0.2586768 [217] -0.2587314 -0.2587860 -0.2588405 -0.2588950 -0.2589495 -0.2590040 [223] -0.2590584 -0.2591128 -0.2591671 -0.2592214 -0.2592757 -0.2593300 [229] -0.2593842 -0.2594384 -0.2594926 -0.2595467 -0.2596008 -0.2596549 [235] -0.2597089 -0.2597630 -0.2598169 -0.2598709 -0.2599248 -0.2599787 [241] -0.2600325 -0.2600863 -0.2601401 -0.2601939 -0.2602476 -0.2603013 [247] -0.2603550 -0.2604086 -0.2604622 -0.2605157 -0.2605693 -0.2606228 [253] -0.2606762 -0.2607297 -0.2607831 -0.2608364 -0.2608898 -0.2609431 [259] -0.2609964 -0.2610496 -0.2611028 -0.2611560 -0.2612091 -0.2612622 [265] -0.2613153 -0.2613683 -0.2614214 -0.2614743 -0.2615273 -0.2615802 [271] -0.2616331 -0.2616859 -0.2617387 -0.2617915 -0.2618443 -0.2618970 [277] -0.2619497 -0.2620023 -0.2620549 -0.2621075 -0.2621601 -0.2622126 [283] -0.2622651 -0.2623175 -0.2623700 -0.2624224 -0.2624747 -0.2625270 [289] -0.2625793 -0.2626316 -0.2626838 -0.2627360 -0.2627881 -0.2628402 [295] -0.2628923 -0.2629444 -0.2629964 -0.2630484 -0.2631003 -0.2631523 [301] -0.2632042 -0.2632560 -0.2633078 -0.2633596 -0.2634114 -0.2634631 [307] -0.2635148 -0.2635664 -0.2636180 -0.2636696 -0.2637212 -0.2637727 [313] -0.2638242 -0.2638756 -0.2639270 -0.2639784 -0.2640297 -0.2640811 [319] -0.2641323 -0.2641836 -0.2642348 -0.2642860 -0.2643371 -0.2643882 [325] -0.2644393 -0.2644903 -0.2645413 -0.2645923 -0.2646432 -0.2646941 [331] -0.2647450 -0.2647959 -0.2648467 -0.2648974 -0.2649481 -0.2649988 [337] -0.2650495 -0.2651001 -0.2651507 -0.2652013 -0.2652518 -0.2653023 [343] -0.2653528 -0.2654032 -0.2654536 -0.2655039 -0.2655542 -0.2656045 [349] -0.2656548 -0.2657050 -0.2657552 -0.2658053 -0.2658554 -0.2659055 [355] -0.2659555 -0.2660055 -0.2660555 -0.2661054 -0.2661553 -0.2662052 [361] -0.2662550 -0.2663048 -0.2663546 -0.2664043 -0.2664540 -0.2665037 [367] -0.2665533 -0.2666029 -0.2666524 -0.2667020 -0.2667514 -0.2668009 [373] -0.2668503 -0.2668997 -0.2669490 -0.2669983 -0.2670476 -0.2670968 [379] -0.2671460 -0.2671952 -0.2672443 -0.2672934 -0.2673425 -0.2673915 [385] -0.2674405 -0.2674895 -0.2675384 -0.2675873 -0.2676361 -0.2676849 [391] -0.2677337 -0.2677824 -0.2678312 -0.2678798 -0.2679285 -0.2679771 [397] -0.2680256 -0.2680742 -0.2681227 -0.2681711 -0.2682195 > mx [1] 0.2682195 > mxli [1] 2 > if (mxli != 0) + { + x1 <- (x^mxli - 1) / mxli + } else { + x1 <- log(x) + } > r<-lm(y~x) > se <- sqrt(var(r$residuals)) > r1 <- lm(y~x1) > se1 <- sqrt(var(r1$residuals)) > postscript(file="/var/www/html/rcomp/tmp/1dy0d1261144712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(l,c,main='Box-Cox Linearity Plot',xlab='Lambda',ylab='correlation') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/24iq31261144712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x,y,main='Linear Fit of Original Data',xlab='x',ylab='y') > abline(r) > grid() > mtext(paste('Residual Standard Deviation = ',se)) > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3qdi71261144712.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x1,y,main='Linear Fit of Transformed Data',xlab='x',ylab='y') > abline(r1) > grid() > mtext(paste('Residual Standard Deviation = ',se1)) > 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 Linearity 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(x)',header=TRUE) > a<-table.element(a,mxli) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (orginial)',header=TRUE) > a<-table.element(a,se) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Residual SD (transformed)',header=TRUE) > a<-table.element(a,se1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/46v6y1261144713.tab") > > try(system("convert tmp/1dy0d1261144712.ps tmp/1dy0d1261144712.png",intern=TRUE)) character(0) > try(system("convert tmp/24iq31261144712.ps tmp/24iq31261144712.png",intern=TRUE)) character(0) > try(system("convert tmp/3qdi71261144712.ps tmp/3qdi71261144712.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.788 0.506 1.750