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(216234,213587,209465,204045,200237,203666,241476,260307,243324,244460,233575,237217,235243,230354,227184,221678,217142,219452,256446,265845,248624,241114,229245,231805,219277,219313,212610,214771,211142,211457,240048,240636,230580,208795,197922,194596,194581,185686,178106,172608,167302,168053,202300,202388,182516,173476,166444,171297,169701,164182,161914,159612,151001,158114,186530,187069,174330,169362,166827,178037,186412,189226,191563,188906,186005,195309,223532,226899,214126) > x <- c(562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590,517945,506174,501866,516141,528222,532638,536322,536535,523597,536214,586570,596594,580523) > #'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.9534548 0.9535148 0.9535807 0.9536424 0.9536999 0.9537604 0.9538176 [8] 0.9538761 0.9539374 0.9539990 0.9540595 0.9541172 0.9541757 0.9542367 [15] 0.9542964 0.9543556 0.9544133 0.9544723 0.9545303 0.9545901 0.9546481 [22] 0.9547056 0.9547636 0.9548209 0.9548789 0.9549360 0.9549934 0.9550505 [29] 0.9551072 0.9551639 0.9552205 0.9552769 0.9553330 0.9553892 0.9554450 [36] 0.9555007 0.9555563 0.9556118 0.9556669 0.9557220 0.9557769 0.9558317 [43] 0.9558863 0.9559407 0.9559949 0.9560490 0.9561030 0.9561567 0.9562103 [50] 0.9562638 0.9563171 0.9563702 0.9564231 0.9564759 0.9565285 0.9565810 [57] 0.9566333 0.9566854 0.9567374 0.9567892 0.9568409 0.9568924 0.9569437 [64] 0.9569949 0.9570459 0.9570967 0.9571474 0.9571979 0.9572482 0.9572984 [71] 0.9573485 0.9573983 0.9574480 0.9574976 0.9575469 0.9575961 0.9576452 [78] 0.9576941 0.9577428 0.9577914 0.9578398 0.9578880 0.9579361 0.9579840 [85] 0.9580318 0.9580794 0.9581268 0.9581741 0.9582212 0.9582681 0.9583149 [92] 0.9583615 0.9584080 0.9584543 0.9585004 0.9585464 0.9585922 0.9586379 [99] 0.9586834 0.9587287 0.9587739 0.9588189 0.9588637 0.9589084 0.9589529 [106] 0.9589973 0.9590415 0.9590855 0.9591294 0.9591731 0.9592167 0.9592600 [113] 0.9593033 0.9593464 0.9593893 0.9594320 0.9594746 0.9595170 0.9595593 [120] 0.9596014 0.9596434 0.9596851 0.9597268 0.9597682 0.9598095 0.9598507 [127] 0.9598917 0.9599325 0.9599731 0.9600136 0.9600540 0.9600942 0.9601342 [134] 0.9601741 0.9602138 0.9602533 0.9602927 0.9603319 0.9603710 0.9604099 [141] 0.9604486 0.9604872 0.9605256 0.9605639 0.9606020 0.9606399 0.9606777 [148] 0.9607153 0.9607528 0.9607901 0.9608272 0.9608642 0.9609010 0.9609377 [155] 0.9609742 0.9610106 0.9610468 0.9610828 0.9611187 0.9611544 0.9611899 [162] 0.9612253 0.9612606 0.9612956 0.9613305 0.9613653 0.9613999 0.9614343 [169] 0.9614686 0.9615028 0.9615367 0.9615705 0.9616042 0.9616377 0.9616710 [176] 0.9617042 0.9617372 0.9617701 0.9618028 0.9618353 0.9618677 0.9618999 [183] 0.9619320 0.9619639 0.9619956 0.9620272 0.9620587 0.9620900 0.9621211 [190] 0.9621521 0.9621829 0.9622135 0.9622440 0.9622743 0.9623045 0.9623345 [197] 0.9623644 0.9623941 0.9624237 0.9624531 0.9624823 0.9625114 0.9625403 [204] 0.9625691 0.9625977 0.9626261 0.9626544 0.9626826 0.9627106 0.9627384 [211] 0.9627661 0.9627936 0.9628209 0.9628481 0.9628752 0.9629021 0.9629288 [218] 0.9629554 0.9629818 0.9630081 0.9630342 0.9630601 0.9630859 0.9631116 [225] 0.9631371 0.9631624 0.9631876 0.9632126 0.9632375 0.9632622 0.9632867 [232] 0.9633111 0.9633354 0.9633595 0.9633834 0.9634072 0.9634308 0.9634543 [239] 0.9634776 0.9635008 0.9635238 0.9635466 0.9635693 0.9635919 0.9636143 [246] 0.9636365 0.9636586 0.9636805 0.9637023 0.9637239 0.9637454 0.9637667 [253] 0.9637879 0.9638089 0.9638297 0.9638504 0.9638710 0.9638914 0.9639116 [260] 0.9639317 0.9639516 0.9639714 0.9639910 0.9640105 0.9640298 0.9640490 [267] 0.9640680 0.9640868 0.9641055 0.9641241 0.9641425 0.9641608 0.9641789 [274] 0.9641968 0.9642146 0.9642322 0.9642497 0.9642671 0.9642842 0.9643013 [281] 0.9643181 0.9643349 0.9643515 0.9643679 0.9643841 0.9644003 0.9644162 [288] 0.9644321 0.9644477 0.9644632 0.9644786 0.9644938 0.9645089 0.9645238 [295] 0.9645386 0.9645532 0.9645676 0.9645819 0.9645961 0.9646101 0.9646239 [302] 0.9646377 0.9646512 0.9646646 0.9646779 0.9646910 0.9647039 0.9647167 [309] 0.9647294 0.9647419 0.9647542 0.9647665 0.9647785 0.9647904 0.9648022 [316] 0.9648138 0.9648252 0.9648365 0.9648477 0.9648587 0.9648696 0.9648803 [323] 0.9648908 0.9649013 0.9649115 0.9649216 0.9649316 0.9649414 0.9649511 [330] 0.9649606 0.9649700 0.9649792 0.9649883 0.9649972 0.9650060 0.9650146 [337] 0.9650231 0.9650315 0.9650397 0.9650477 0.9650556 0.9650633 0.9650709 [344] 0.9650784 0.9650857 0.9650929 0.9650999 0.9651067 0.9651135 0.9651200 [351] 0.9651265 0.9651327 0.9651389 0.9651448 0.9651507 0.9651564 0.9651619 [358] 0.9651673 0.9651726 0.9651777 0.9651826 0.9651875 0.9651921 0.9651966 [365] 0.9652010 0.9652053 0.9652093 0.9652133 0.9652171 0.9652207 0.9652242 [372] 0.9652276 0.9652308 0.9652339 0.9652368 0.9652396 0.9652422 0.9652447 [379] 0.9652471 0.9652493 0.9652513 0.9652532 0.9652550 0.9652566 0.9652581 [386] 0.9652594 0.9652606 0.9652617 0.9652626 0.9652634 0.9652640 0.9652644 [393] 0.9652648 0.9652650 0.9652650 0.9652649 0.9652647 0.9652643 0.9652638 [400] 0.9652631 0.9652623 > mx [1] 0.965265 > mxli [1] 1.94 > 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/1dxeu1258125877.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/2i3pv1258125877.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/3xmjv1258125877.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/48xq21258125877.tab") > system("convert tmp/1dxeu1258125877.ps tmp/1dxeu1258125877.png") > system("convert tmp/2i3pv1258125877.ps tmp/2i3pv1258125877.png") > system("convert tmp/3xmjv1258125877.ps tmp/3xmjv1258125877.png") > > > proc.time() user system elapsed 0.809 0.527 0.944