R version 2.8.0 (2008-10-20) 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(2468.9,2469.2,2417.7,2411.1,2361,1924.1,2486.9,2674.9,2296.2,2101.5,2322,2273.8,2501.3,2435.2,2273.3,2454.7,2328.8,1897,2608.1,2712.3,2322,2282.6,2241.1,2417.2,2829,2600.6,2321,2768.5,2457.3,2142.7,2764.4,2788.9,2679.5,2536.5,2682.7,2699.6,3097.8,3015.2,2878,3010.9,2612.3,2419.3,3096.5,3013,3397.4,3423.1,3298.7,3065.7,3918.3,3154.4,3334.7,3461.6,3018.5,2832,3301.3,3342.8,3464.4,3016.6,3201.3,3135.3,3549.8,3247.2,3441.8,3535.6,3384.7,2996.6,3402.8,3900.2,3776.4,3197.5,4022.4,3845.1,3818.6) > x <- c(12710.3,12120.8,12469.5,12054.6,12112.9,9617.2,12645.8,13581.3,12162.3,10969.7,11880,11887.6,12926.9,12300,12092.8,12380.8,12196.9,9455,13168,13427.9,11980.5,11884.8,11691.7,12233.8,14341.4,13130.7,12421.1,14285.8,12864.6,11160.2,14316.2,14388.7,14013.9,13419,12769.6,13315.5,15332.9,14243,13824.4,14962.9,13202.9,12199,15508.9,14199.8,15169.6,14058,13786.2,14147.9,16541.7,13587.5,15582.4,15802.8,14130.5,12923.2,15612.2,16033.7,16036.6,14037.8,15330.6,15038.3,17401.8,14992.5,16043.7,16929.6,15921.3,14417.2,15961,17851.9,16483.9,14215.5,17429.7,17839.5,17629.2) > #'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.9033346 0.9036682 0.9040008 0.9043322 0.9046626 0.9049918 0.9053200 [8] 0.9056470 0.9059729 0.9062977 0.9066214 0.9069440 0.9072655 0.9075858 [15] 0.9079051 0.9082232 0.9085403 0.9088562 0.9091710 0.9094847 0.9097973 [22] 0.9101088 0.9104191 0.9107284 0.9110365 0.9113435 0.9116494 0.9119542 [29] 0.9122578 0.9125604 0.9128618 0.9131621 0.9134613 0.9137594 0.9140563 [36] 0.9143522 0.9146469 0.9149405 0.9152330 0.9155244 0.9158146 0.9161038 [43] 0.9163918 0.9166787 0.9169644 0.9172491 0.9175326 0.9178151 0.9180964 [50] 0.9183765 0.9186556 0.9189336 0.9192104 0.9194861 0.9197607 0.9200342 [57] 0.9203065 0.9205778 0.9208479 0.9211169 0.9213848 0.9216515 0.9219172 [64] 0.9221817 0.9224451 0.9227074 0.9229686 0.9232287 0.9234876 0.9237455 [71] 0.9240022 0.9242578 0.9245123 0.9247657 0.9250179 0.9252691 0.9255191 [78] 0.9257681 0.9260159 0.9262626 0.9265082 0.9267527 0.9269960 0.9272383 [85] 0.9274795 0.9277195 0.9279584 0.9281963 0.9284330 0.9286686 0.9289031 [92] 0.9291365 0.9293688 0.9296000 0.9298301 0.9300591 0.9302870 0.9305138 [99] 0.9307395 0.9309640 0.9311875 0.9314099 0.9316312 0.9318514 0.9320705 [106] 0.9322885 0.9325054 0.9327212 0.9329359 0.9331495 0.9333620 0.9335734 [113] 0.9337838 0.9339930 0.9342012 0.9344083 0.9346143 0.9348192 0.9350230 [120] 0.9352257 0.9354273 0.9356279 0.9358274 0.9360258 0.9362231 0.9364193 [127] 0.9366145 0.9368086 0.9370016 0.9371935 0.9373843 0.9375741 0.9377628 [134] 0.9379505 0.9381370 0.9383225 0.9385069 0.9386903 0.9388726 0.9390538 [141] 0.9392340 0.9394130 0.9395911 0.9397680 0.9399440 0.9401188 0.9402926 [148] 0.9404653 0.9406370 0.9408076 0.9409772 0.9411457 0.9413132 0.9414796 [155] 0.9416450 0.9418093 0.9419726 0.9421348 0.9422960 0.9424561 0.9426152 [162] 0.9427733 0.9429303 0.9430863 0.9432413 0.9433952 0.9435481 0.9436999 [169] 0.9438507 0.9440005 0.9441492 0.9442970 0.9444437 0.9445893 0.9447340 [176] 0.9448776 0.9450202 0.9451618 0.9453024 0.9454419 0.9455805 0.9457180 [183] 0.9458545 0.9459900 0.9461245 0.9462580 0.9463904 0.9465219 0.9466524 [190] 0.9467818 0.9469103 0.9470377 0.9471642 0.9472896 0.9474141 0.9475376 [197] 0.9476600 0.9477815 0.9479020 0.9480215 0.9481400 0.9482576 0.9483741 [204] 0.9484897 0.9486042 0.9487178 0.9488305 0.9489421 0.9490528 0.9491625 [211] 0.9492712 0.9493789 0.9494857 0.9495915 0.9496964 0.9498003 0.9499032 [218] 0.9500052 0.9501062 0.9502062 0.9503053 0.9504034 0.9505006 0.9505968 [225] 0.9506921 0.9507864 0.9508798 0.9509722 0.9510637 0.9511542 0.9512438 [232] 0.9513325 0.9514202 0.9515070 0.9515928 0.9516777 0.9517617 0.9518448 [239] 0.9519269 0.9520081 0.9520884 0.9521677 0.9522462 0.9523237 0.9524003 [246] 0.9524759 0.9525507 0.9526245 0.9526975 0.9527695 0.9528406 0.9529108 [253] 0.9529801 0.9530485 0.9531160 0.9531826 0.9532483 0.9533131 0.9533770 [260] 0.9534400 0.9535021 0.9535633 0.9536237 0.9536831 0.9537417 0.9537993 [267] 0.9538561 0.9539121 0.9539671 0.9540213 0.9540746 0.9541270 0.9541785 [274] 0.9542292 0.9542790 0.9543279 0.9543760 0.9544232 0.9544695 0.9545150 [281] 0.9545596 0.9546034 0.9546463 0.9546884 0.9547296 0.9547700 0.9548095 [288] 0.9548481 0.9548860 0.9549229 0.9549591 0.9549944 0.9550288 0.9550624 [295] 0.9550952 0.9551272 0.9551583 0.9551886 0.9552181 0.9552467 0.9552745 [302] 0.9553015 0.9553277 0.9553531 0.9553776 0.9554013 0.9554242 0.9554463 [309] 0.9554676 0.9554881 0.9555078 0.9555267 0.9555447 0.9555620 0.9555784 [316] 0.9555941 0.9556090 0.9556231 0.9556363 0.9556488 0.9556605 0.9556714 [323] 0.9556816 0.9556909 0.9556995 0.9557072 0.9557142 0.9557204 0.9557259 [330] 0.9557306 0.9557345 0.9557376 0.9557399 0.9557415 0.9557424 0.9557424 [337] 0.9557417 0.9557403 0.9557380 0.9557351 0.9557313 0.9557269 0.9557216 [344] 0.9557156 0.9557089 0.9557014 0.9556932 0.9556842 0.9556745 0.9556641 [351] 0.9556529 0.9556409 0.9556283 0.9556149 0.9556008 0.9555859 0.9555703 [358] 0.9555540 0.9555370 0.9555192 0.9555008 0.9554816 0.9554617 0.9554410 [365] 0.9554197 0.9553976 0.9553749 0.9553514 0.9553272 0.9553023 0.9552767 [372] 0.9552504 0.9552234 0.9551957 0.9551674 0.9551383 0.9551085 0.9550780 [379] 0.9550468 0.9550150 0.9549824 0.9549492 0.9549153 0.9548807 0.9548454 [386] 0.9548095 0.9547729 0.9547356 0.9546976 0.9546589 0.9546196 0.9545796 [393] 0.9545389 0.9544976 0.9544556 0.9544130 0.9543697 0.9543257 0.9542811 [400] 0.9542358 0.9541898 > mx [1] 0.9557424 > mxli [1] 1.35 > 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/freestat/rcomp/tmp/1pxxs1226419613.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/freestat/rcomp/tmp/2k0eq1226419613.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/freestat/rcomp/tmp/3o9111226419613.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/4mcqf1226419613.tab") > > system("convert tmp/1pxxs1226419613.ps tmp/1pxxs1226419613.png") > system("convert tmp/2k0eq1226419613.ps tmp/2k0eq1226419613.png") > system("convert tmp/3o9111226419613.ps tmp/3o9111226419613.png") > > > proc.time() user system elapsed 1.215 0.812 1.333