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(2,1.8,2.7,2.3,1.9,2,2.3,2.8,2.4,2.3,2.7,2.7,2.9,3,2.2,2.3,2.8,2.8,2.8,2.2,2.6,2.8,2.5,2.4,2.3,1.9,1.7,2,2.1,1.7,1.8,1.8,1.8,1.3,1.3,1.3,1.2,1.4,2.2,2.9,3.1,3.5,3.6,4.4,4.1,5.1,5.8,5.9,5.4,5.5,4.8,3.2,2.7,2.1,1.9,0.6,0.7,-0.2,-1,-1.7,-0.7) > x <- c(7.5,7.4,7.1,6.8,6.9,7.2,7.4,7.3,6.9,6.9,6.8,7.1,7.2,7.1,7,6.9,7.1,7.3,7.5,7.5,7.5,7.3,7,6.7,6.5,6.5,6.5,6.6,6.8,6.9,6.9,6.8,6.8,6.5,6.1,6.1,5.9,5.7,5.9,5.9,6.1,6.3,6.2,5.9,5.7,5.4,5.6,6.2,6.3,6,5.6,5.5,5.9,6.5,6.8,6.8,6.5,6.2,6.2,6.5,6.7) > #'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.3077360 -0.3075819 -0.3074278 -0.3072737 -0.3071194 -0.3069651 [7] -0.3068107 -0.3066562 -0.3065017 -0.3063471 -0.3061924 -0.3060377 [13] -0.3058828 -0.3057279 -0.3055730 -0.3054179 -0.3052628 -0.3051077 [19] -0.3049524 -0.3047971 -0.3046417 -0.3044863 -0.3043307 -0.3041752 [25] -0.3040195 -0.3038638 -0.3037080 -0.3035521 -0.3033962 -0.3032402 [31] -0.3030841 -0.3029279 -0.3027717 -0.3026155 -0.3024591 -0.3023027 [37] -0.3021462 -0.3019897 -0.3018331 -0.3016764 -0.3015197 -0.3013629 [43] -0.3012060 -0.3010491 -0.3008920 -0.3007350 -0.3005778 -0.3004206 [49] -0.3002634 -0.3001061 -0.2999487 -0.2997912 -0.2996337 -0.2994761 [55] -0.2993184 -0.2991607 -0.2990030 -0.2988451 -0.2986872 -0.2985292 [61] -0.2983712 -0.2982131 -0.2980550 -0.2978968 -0.2977385 -0.2975801 [67] -0.2974217 -0.2972633 -0.2971048 -0.2969462 -0.2967875 -0.2966288 [73] -0.2964701 -0.2963112 -0.2961523 -0.2959934 -0.2958344 -0.2956753 [79] -0.2955162 -0.2953570 -0.2951978 -0.2950385 -0.2948791 -0.2947197 [85] -0.2945602 -0.2944007 -0.2942411 -0.2940814 -0.2939217 -0.2937619 [91] -0.2936021 -0.2934422 -0.2932823 -0.2931223 -0.2929622 -0.2928021 [97] -0.2926419 -0.2924817 -0.2923214 -0.2921611 -0.2920007 -0.2918403 [103] -0.2916798 -0.2915192 -0.2913586 -0.2911979 -0.2910372 -0.2908765 [109] -0.2907156 -0.2905547 -0.2903938 -0.2902328 -0.2900718 -0.2899107 [115] -0.2897495 -0.2895883 -0.2894271 -0.2892658 -0.2891044 -0.2889430 [121] -0.2887816 -0.2886200 -0.2884585 -0.2882969 -0.2881352 -0.2879735 [127] -0.2878117 -0.2876499 -0.2874880 -0.2873261 -0.2871641 -0.2870021 [133] -0.2868400 -0.2866779 -0.2865158 -0.2863535 -0.2861913 -0.2860290 [139] -0.2858666 -0.2857042 -0.2855417 -0.2853792 -0.2852167 -0.2850541 [145] -0.2848914 -0.2847287 -0.2845660 -0.2844032 -0.2842404 -0.2840775 [151] -0.2839145 -0.2837516 -0.2835885 -0.2834255 -0.2832624 -0.2830992 [157] -0.2829360 -0.2827728 -0.2826095 -0.2824461 -0.2822827 -0.2821193 [163] -0.2819558 -0.2817923 -0.2816288 -0.2814652 -0.2813015 -0.2811378 [169] -0.2809741 -0.2808103 -0.2806465 -0.2804827 -0.2803188 -0.2801548 [175] -0.2799908 -0.2798268 -0.2796627 -0.2794986 -0.2793345 -0.2791703 [181] -0.2790061 -0.2788418 -0.2786775 -0.2785131 -0.2783487 -0.2781843 [187] -0.2780198 -0.2778553 -0.2776908 -0.2775262 -0.2773616 -0.2771969 [193] -0.2770322 -0.2768675 -0.2767027 -0.2765379 -0.2763730 -0.2762081 [199] -0.2760432 -0.2758782 -0.2757132 -0.2755482 -0.2753831 -0.2752180 [205] -0.2750529 -0.2748877 -0.2747225 -0.2745572 -0.2743919 -0.2742266 [211] -0.2740612 -0.2738958 -0.2737304 -0.2735650 -0.2733995 -0.2732339 [217] -0.2730684 -0.2729028 -0.2727371 -0.2725715 -0.2724058 -0.2722400 [223] -0.2720743 -0.2719085 -0.2717427 -0.2715768 -0.2714109 -0.2712450 [229] -0.2710790 -0.2709130 -0.2707470 -0.2705810 -0.2704149 -0.2702488 [235] -0.2700827 -0.2699165 -0.2697503 -0.2695841 -0.2694178 -0.2692515 [241] -0.2690852 -0.2689188 -0.2687525 -0.2685861 -0.2684196 -0.2682532 [247] -0.2680867 -0.2679202 -0.2677536 -0.2675871 -0.2674205 -0.2672538 [253] -0.2670872 -0.2669205 -0.2667538 -0.2665871 -0.2664203 -0.2662535 [259] -0.2660867 -0.2659199 -0.2657530 -0.2655862 -0.2654193 -0.2652523 [265] -0.2650854 -0.2649184 -0.2647514 -0.2645843 -0.2644173 -0.2642502 [271] -0.2640831 -0.2639160 -0.2637488 -0.2635817 -0.2634145 -0.2632473 [277] -0.2630800 -0.2629128 -0.2627455 -0.2625782 -0.2624109 -0.2622435 [283] -0.2620762 -0.2619088 -0.2617414 -0.2615739 -0.2614065 -0.2612390 [289] -0.2610715 -0.2609040 -0.2607365 -0.2605689 -0.2604014 -0.2602338 [295] -0.2600662 -0.2598986 -0.2597309 -0.2595633 -0.2593956 -0.2592279 [301] -0.2590602 -0.2588925 -0.2587247 -0.2585570 -0.2583892 -0.2582214 [307] -0.2580536 -0.2578857 -0.2577179 -0.2575500 -0.2573821 -0.2572143 [313] -0.2570463 -0.2568784 -0.2567105 -0.2565425 -0.2563746 -0.2562066 [319] -0.2560386 -0.2558706 -0.2557026 -0.2555345 -0.2553665 -0.2551984 [325] -0.2550303 -0.2548622 -0.2546941 -0.2545260 -0.2543579 -0.2541898 [331] -0.2540216 -0.2538534 -0.2536853 -0.2535171 -0.2533489 -0.2531807 [337] -0.2530125 -0.2528442 -0.2526760 -0.2525077 -0.2523395 -0.2521712 [343] -0.2520029 -0.2518347 -0.2516664 -0.2514981 -0.2513297 -0.2511614 [349] -0.2509931 -0.2508247 -0.2506564 -0.2504880 -0.2503197 -0.2501513 [355] -0.2499829 -0.2498145 -0.2496462 -0.2494778 -0.2493093 -0.2491409 [361] -0.2489725 -0.2488041 -0.2486357 -0.2484672 -0.2482988 -0.2481303 [367] -0.2479619 -0.2477934 -0.2476250 -0.2474565 -0.2472880 -0.2471196 [373] -0.2469511 -0.2467826 -0.2466141 -0.2464456 -0.2462771 -0.2461087 [379] -0.2459402 -0.2457717 -0.2456032 -0.2454346 -0.2452661 -0.2450976 [385] -0.2449291 -0.2447606 -0.2445921 -0.2444236 -0.2442551 -0.2440866 [391] -0.2439180 -0.2437495 -0.2435810 -0.2434125 -0.2432440 -0.2430755 [397] -0.2429070 -0.2427384 -0.2425699 -0.2424014 -0.2422329 > mx [1] 0.307736 > 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/1tcb11261042712.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/2b3uj1261042712.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/3th2h1261042712.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/4klib1261042712.tab") > > try(system("convert tmp/1tcb11261042712.ps tmp/1tcb11261042712.png",intern=TRUE)) character(0) > try(system("convert tmp/2b3uj1261042712.ps tmp/2b3uj1261042712.png",intern=TRUE)) character(0) > try(system("convert tmp/3th2h1261042712.ps tmp/3th2h1261042712.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.777 0.511 1.954