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(9487,8700,9627,8947,9283,8829,9947,9628,9318,9605,8640,9214,9567,8547,9185,9470,9123,9278,10170,9434,9655,9429,8739,9552,9784,9089,9763,9330,9144,9895,10404,10195,9987,9789,9437,10096,9776,9106,10258,9766,9826,9957,10036,10508,10146,10166,9365,9968,10123,9144,10447,9699,10451,10192,10404,10597,10633,10727,9784,9667,10297,9426,10274,9598,10400,9985,10761,11081,10297,10751,9760,10133,10806,9734,10083,10691,10446,10517,11353,10436,10721,10701,9793,10142) > x <- c(1169,2154,2249,2687,4359,5382,4459,6398,4596,3024,1887,2070,1351,2218,2461,3028,4784,4975,4607,6249,4809,3157,1910,2228,1594,2467,2222,3607,4685,4962,5770,5480,5000,3228,1993,2288,1580,2111,2192,3601,4665,4876,5813,5589,5331,3075,2002,2306,1507,1992,2487,3490,4647,5594,5611,5788,6204,3013,1931,2549,1504,2090,2702,2939,4500,6208,6415,5657,5964,3163,1997,2422,1376,2202,2683,3303,5202,5231,4880,7998,4977,3531,2025,2205) > #'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.2378942 0.2386057 0.2393169 0.2400279 0.2407386 0.2414490 0.2421592 [8] 0.2428690 0.2435784 0.2442874 0.2449961 0.2457043 0.2464120 0.2471193 [15] 0.2478261 0.2485323 0.2492381 0.2499432 0.2506478 0.2513517 0.2520551 [22] 0.2527577 0.2534597 0.2541610 0.2548615 0.2555614 0.2562604 0.2569586 [29] 0.2576560 0.2583526 0.2590484 0.2597432 0.2604371 0.2611301 0.2618222 [36] 0.2625132 0.2632033 0.2638924 0.2645804 0.2652674 0.2659532 0.2666380 [43] 0.2673216 0.2680041 0.2686854 0.2693655 0.2700444 0.2707220 0.2713984 [50] 0.2720735 0.2727473 0.2734198 0.2740909 0.2747607 0.2754291 0.2760961 [57] 0.2767616 0.2774257 0.2780883 0.2787494 0.2794091 0.2800671 0.2807237 [64] 0.2813786 0.2820320 0.2826838 0.2833339 0.2839824 0.2846292 0.2852743 [71] 0.2859177 0.2865594 0.2871994 0.2878375 0.2884739 0.2891085 0.2897413 [78] 0.2903722 0.2910013 0.2916285 0.2922538 0.2928773 0.2934987 0.2941183 [85] 0.2947359 0.2953515 0.2959651 0.2965767 0.2971863 0.2977938 0.2983993 [92] 0.2990027 0.2996040 0.3002032 0.3008003 0.3013953 0.3019881 0.3025788 [99] 0.3031672 0.3037535 0.3043376 0.3049194 0.3054990 0.3060764 0.3066515 [106] 0.3072243 0.3077949 0.3083631 0.3089290 0.3094926 0.3100539 0.3106128 [113] 0.3111693 0.3117235 0.3122753 0.3128247 0.3133716 0.3139162 0.3144583 [120] 0.3149980 0.3155353 0.3160700 0.3166023 0.3171322 0.3176595 0.3181843 [127] 0.3187067 0.3192265 0.3197437 0.3202585 0.3207707 0.3212803 0.3217874 [134] 0.3222919 0.3227939 0.3232932 0.3237900 0.3242842 0.3247757 0.3252647 [141] 0.3257510 0.3262347 0.3267158 0.3271943 0.3276701 0.3281432 0.3286137 [148] 0.3290816 0.3295468 0.3300093 0.3304691 0.3309263 0.3313807 0.3318325 [155] 0.3322816 0.3327280 0.3331718 0.3336128 0.3340511 0.3344867 0.3349196 [162] 0.3353497 0.3357772 0.3362020 0.3366240 0.3370433 0.3374599 0.3378737 [169] 0.3382848 0.3386932 0.3390989 0.3395018 0.3399020 0.3402995 0.3406942 [176] 0.3410862 0.3414755 0.3418620 0.3422458 0.3426269 0.3430052 0.3433808 [183] 0.3437536 0.3441238 0.3444912 0.3448558 0.3452177 0.3455769 0.3459334 [190] 0.3462872 0.3466382 0.3469865 0.3473320 0.3476749 0.3480150 0.3483524 [197] 0.3486872 0.3490191 0.3493484 0.3496750 0.3499989 0.3503201 0.3506386 [204] 0.3509543 0.3512674 0.3515778 0.3518856 0.3521906 0.3524930 0.3527927 [211] 0.3530897 0.3533840 0.3536757 0.3539648 0.3542512 0.3545349 0.3548160 [218] 0.3550944 0.3553702 0.3556434 0.3559140 0.3561819 0.3564472 0.3567099 [225] 0.3569700 0.3572275 0.3574823 0.3577346 0.3579843 0.3582315 0.3584760 [232] 0.3587180 0.3589574 0.3591942 0.3594285 0.3596603 0.3598894 0.3601161 [239] 0.3603402 0.3605618 0.3607809 0.3609975 0.3612115 0.3614231 0.3616321 [246] 0.3618387 0.3620428 0.3622443 0.3624435 0.3626401 0.3628343 0.3630261 [253] 0.3632154 0.3634022 0.3635866 0.3637686 0.3639482 0.3641254 0.3643001 [260] 0.3644724 0.3646424 0.3648099 0.3649751 0.3651379 0.3652983 0.3654564 [267] 0.3656121 0.3657655 0.3659165 0.3660652 0.3662115 0.3663556 0.3664973 [274] 0.3666367 0.3667738 0.3669086 0.3670411 0.3671713 0.3672993 0.3674250 [281] 0.3675484 0.3676696 0.3677885 0.3679052 0.3680196 0.3681318 0.3682418 [288] 0.3683496 0.3684552 0.3685585 0.3686597 0.3687587 0.3688555 0.3689501 [295] 0.3690426 0.3691329 0.3692211 0.3693071 0.3693909 0.3694727 0.3695523 [302] 0.3696297 0.3697051 0.3697784 0.3698495 0.3699186 0.3699855 0.3700504 [309] 0.3701133 0.3701740 0.3702327 0.3702893 0.3703439 0.3703964 0.3704469 [316] 0.3704954 0.3705419 0.3705863 0.3706287 0.3706691 0.3707076 0.3707440 [323] 0.3707784 0.3708109 0.3708414 0.3708699 0.3708965 0.3709211 0.3709438 [330] 0.3709645 0.3709833 0.3710001 0.3710151 0.3710281 0.3710392 0.3710484 [337] 0.3710557 0.3710611 0.3710646 0.3710662 0.3710660 0.3710639 0.3710599 [344] 0.3710540 0.3710463 0.3710368 0.3710254 0.3710122 0.3709972 0.3709803 [351] 0.3709616 0.3709411 0.3709188 0.3708947 0.3708687 0.3708410 0.3708116 [358] 0.3707803 0.3707472 0.3707124 0.3706758 0.3706375 0.3705974 0.3705556 [365] 0.3705120 0.3704667 0.3704196 0.3703708 0.3703203 0.3702681 0.3702142 [372] 0.3701585 0.3701012 0.3700421 0.3699814 0.3699190 0.3698549 0.3697891 [379] 0.3697217 0.3696526 0.3695818 0.3695093 0.3694353 0.3693595 0.3692822 [386] 0.3692031 0.3691225 0.3690402 0.3689563 0.3688708 0.3687837 0.3686949 [393] 0.3686046 0.3685127 0.3684191 0.3683240 0.3682273 0.3681290 0.3680291 [400] 0.3679277 0.3678246 > mx [1] 0.3710662 > mxli [1] 1.39 > 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/11mux1261152658.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/2zk6w1261152658.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/3dfbd1261152658.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/4eie51261152658.tab") > > try(system("convert tmp/11mux1261152658.ps tmp/11mux1261152658.png",intern=TRUE)) character(0) > try(system("convert tmp/2zk6w1261152658.ps tmp/2zk6w1261152658.png",intern=TRUE)) character(0) > try(system("convert tmp/3dfbd1261152658.ps tmp/3dfbd1261152658.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.791 0.506 1.301