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. > y <- c(22780,17351,21382,24561,17409,11514,31514,27071,29462,26105,22397,23843,21705,18089,20764,25316,17704,15548,28029,29383,36438,32034,22679,24319,18004,17537,20366,22782,19169,13807,29743,25591,29096,26482,22405,27044,17970,18730,19684,19785,18479,10698,31956,29506,34506,27165,26736,23691,18157,17328,18205,20995,17382,9367,31124,26551,30651,25859,25100,25778,20418,18688,20424,24776,19814,12738,31566,30111,30019,31934,25826,26835) > x <- c(517,525,523,519,509,512,519,517,510,509,501,507,569,580,578,565,547,555,562,561,555,544,537,543,594,611,613,611,594,595,591,589,584,573,567,569,621,629,628,612,595,597,593,590,580,574,573,573,620,626,620,588,566,557,561,549,532,526,511,499,555,565,542,527,510,514,517,508,493,490,469,478) > #'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.2710794 -0.2711246 -0.2711697 -0.2712149 -0.2712600 -0.2713052 [7] -0.2713503 -0.2713955 -0.2714406 -0.2714857 -0.2715308 -0.2715760 [13] -0.2716211 -0.2716662 -0.2717113 -0.2717564 -0.2718015 -0.2718466 [19] -0.2718917 -0.2719367 -0.2719818 -0.2720269 -0.2720720 -0.2721170 [25] -0.2721621 -0.2722072 -0.2722522 -0.2722973 -0.2723423 -0.2723873 [31] -0.2724324 -0.2724774 -0.2725224 -0.2725674 -0.2726125 -0.2726575 [37] -0.2727025 -0.2727475 -0.2727925 -0.2728375 -0.2728824 -0.2729274 [43] -0.2729724 -0.2730174 -0.2730623 -0.2731073 -0.2731523 -0.2731972 [49] -0.2732422 -0.2732871 -0.2733320 -0.2733770 -0.2734219 -0.2734668 [55] -0.2735117 -0.2735566 -0.2736015 -0.2736464 -0.2736913 -0.2737362 [61] -0.2737811 -0.2738260 -0.2738709 -0.2739157 -0.2739606 -0.2740055 [67] -0.2740503 -0.2740952 -0.2741400 -0.2741848 -0.2742297 -0.2742745 [73] -0.2743193 -0.2743641 -0.2744089 -0.2744537 -0.2744985 -0.2745433 [79] -0.2745881 -0.2746329 -0.2746777 -0.2747224 -0.2747672 -0.2748119 [85] -0.2748567 -0.2749014 -0.2749462 -0.2749909 -0.2750356 -0.2750803 [91] -0.2751251 -0.2751698 -0.2752145 -0.2752592 -0.2753039 -0.2753485 [97] -0.2753932 -0.2754379 -0.2754826 -0.2755272 -0.2755719 -0.2756165 [103] -0.2756612 -0.2757058 -0.2757504 -0.2757950 -0.2758397 -0.2758843 [109] -0.2759289 -0.2759735 -0.2760181 -0.2760626 -0.2761072 -0.2761518 [115] -0.2761963 -0.2762409 -0.2762855 -0.2763300 -0.2763745 -0.2764191 [121] -0.2764636 -0.2765081 -0.2765526 -0.2765971 -0.2766416 -0.2766861 [127] -0.2767306 -0.2767751 -0.2768195 -0.2768640 -0.2769085 -0.2769529 [133] -0.2769973 -0.2770418 -0.2770862 -0.2771306 -0.2771750 -0.2772194 [139] -0.2772638 -0.2773082 -0.2773526 -0.2773970 -0.2774414 -0.2774857 [145] -0.2775301 -0.2775744 -0.2776188 -0.2776631 -0.2777074 -0.2777517 [151] -0.2777961 -0.2778404 -0.2778847 -0.2779289 -0.2779732 -0.2780175 [157] -0.2780618 -0.2781060 -0.2781503 -0.2781945 -0.2782388 -0.2782830 [163] -0.2783272 -0.2783714 -0.2784156 -0.2784598 -0.2785040 -0.2785482 [169] -0.2785924 -0.2786365 -0.2786807 -0.2787248 -0.2787690 -0.2788131 [175] -0.2788572 -0.2789013 -0.2789454 -0.2789896 -0.2790336 -0.2790777 [181] -0.2791218 -0.2791659 -0.2792099 -0.2792540 -0.2792980 -0.2793421 [187] -0.2793861 -0.2794301 -0.2794741 -0.2795181 -0.2795621 -0.2796061 [193] -0.2796501 -0.2796940 -0.2797380 -0.2797819 -0.2798259 -0.2798698 [199] -0.2799137 -0.2799577 -0.2800016 -0.2800455 -0.2800894 -0.2801332 [205] -0.2801771 -0.2802210 -0.2802648 -0.2803087 -0.2803525 -0.2803963 [211] -0.2804401 -0.2804840 -0.2805278 -0.2805715 -0.2806153 -0.2806591 [217] -0.2807029 -0.2807466 -0.2807904 -0.2808341 -0.2808778 -0.2809215 [223] -0.2809653 -0.2810090 -0.2810526 -0.2810963 -0.2811400 -0.2811837 [229] -0.2812273 -0.2812710 -0.2813146 -0.2813582 -0.2814018 -0.2814454 [235] -0.2814890 -0.2815326 -0.2815762 -0.2816198 -0.2816633 -0.2817069 [241] -0.2817504 -0.2817939 -0.2818374 -0.2818809 -0.2819244 -0.2819679 [247] -0.2820114 -0.2820549 -0.2820983 -0.2821418 -0.2821852 -0.2822287 [253] -0.2822721 -0.2823155 -0.2823589 -0.2824023 -0.2824456 -0.2824890 [259] -0.2825324 -0.2825757 -0.2826190 -0.2826624 -0.2827057 -0.2827490 [265] -0.2827923 -0.2828356 -0.2828788 -0.2829221 -0.2829654 -0.2830086 [271] -0.2830518 -0.2830951 -0.2831383 -0.2831815 -0.2832247 -0.2832678 [277] -0.2833110 -0.2833542 -0.2833973 -0.2834404 -0.2834836 -0.2835267 [283] -0.2835698 -0.2836129 -0.2836560 -0.2836990 -0.2837421 -0.2837851 [289] -0.2838282 -0.2838712 -0.2839142 -0.2839572 -0.2840002 -0.2840432 [295] -0.2840862 -0.2841291 -0.2841721 -0.2842150 -0.2842579 -0.2843009 [301] -0.2843438 -0.2843867 -0.2844295 -0.2844724 -0.2845153 -0.2845581 [307] -0.2846009 -0.2846438 -0.2846866 -0.2847294 -0.2847722 -0.2848149 [313] -0.2848577 -0.2849005 -0.2849432 -0.2849859 -0.2850286 -0.2850713 [319] -0.2851140 -0.2851567 -0.2851994 -0.2852421 -0.2852847 -0.2853273 [325] -0.2853700 -0.2854126 -0.2854552 -0.2854977 -0.2855403 -0.2855829 [331] -0.2856254 -0.2856680 -0.2857105 -0.2857530 -0.2857955 -0.2858380 [337] -0.2858805 -0.2859229 -0.2859654 -0.2860078 -0.2860503 -0.2860927 [343] -0.2861351 -0.2861775 -0.2862198 -0.2862622 -0.2863045 -0.2863469 [349] -0.2863892 -0.2864315 -0.2864738 -0.2865161 -0.2865584 -0.2866006 [355] -0.2866429 -0.2866851 -0.2867274 -0.2867696 -0.2868118 -0.2868539 [361] -0.2868961 -0.2869383 -0.2869804 -0.2870226 -0.2870647 -0.2871068 [367] -0.2871489 -0.2871910 -0.2872330 -0.2872751 -0.2873171 -0.2873591 [373] -0.2874012 -0.2874432 -0.2874851 -0.2875271 -0.2875691 -0.2876110 [379] -0.2876529 -0.2876949 -0.2877368 -0.2877787 -0.2878205 -0.2878624 [385] -0.2879043 -0.2879461 -0.2879879 -0.2880297 -0.2880715 -0.2881133 [391] -0.2881551 -0.2881968 -0.2882386 -0.2882803 -0.2883220 -0.2883637 [397] -0.2884054 -0.2884471 -0.2884887 -0.2885304 -0.2885720 > mx [1] 0.288572 > 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/194qo1226399004.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/2mhub1226399004.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/32jou1226399004.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/4ge551226399004.tab") > > system("convert tmp/194qo1226399004.ps tmp/194qo1226399004.png") > system("convert tmp/2mhub1226399004.ps tmp/2mhub1226399004.png") > system("convert tmp/32jou1226399004.ps tmp/32jou1226399004.png") > > > proc.time() user system elapsed 1.852 0.820 1.987