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(27,25,20,19,19,17,12,13,13,11,4,8,1,5,4,3,4,2,8,-2,1,0,1,7,1,0,-3,0,3,1,3,2,6,2,3,9,12,8,7,9,11,13,9,9,13,14,16,20,19,18,18,19,16,10,11,17,3,14,15,17,20,19,21,17,15,18,19,16,21,26,23,24,23,19,25,21,19,20,20,17,25,19,13,15,15,13,11,9,2,-2,-4,-2) > x <- c(25,27,25,23,24,24,26,25,24,24,22,22,22,27,24,24,22,23,25,23,21,21,22,20,22,22,20,21,20,21,21,21,19,21,21,22,19,24,22,22,22,24,22,23,24,21,20,22,23,23,22,20,21,21,20,20,17,18,19,19,20,21,20,21,19,22,20,18,16,17,18,19,18,20,21,18,19,19,19,21,19,19,17,16,16,17,16,15,16,16,16,18) > #'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.03072370 -0.03077624 -0.03082855 -0.03088064 -0.03093249 -0.03098412 [7] -0.03103551 -0.03108668 -0.03113761 -0.03118831 -0.03123878 -0.03128902 [13] -0.03133903 -0.03138880 -0.03143834 -0.03148764 -0.03153672 -0.03158555 [19] -0.03163415 -0.03168252 -0.03173065 -0.03177854 -0.03182620 -0.03187362 [25] -0.03192081 -0.03196775 -0.03201446 -0.03206093 -0.03210716 -0.03215315 [31] -0.03219891 -0.03224442 -0.03228969 -0.03233472 -0.03237951 -0.03242406 [37] -0.03246837 -0.03251244 -0.03255626 -0.03259984 -0.03264318 -0.03268627 [43] -0.03272912 -0.03277173 -0.03281409 -0.03285621 -0.03289808 -0.03293971 [49] -0.03298109 -0.03302222 -0.03306311 -0.03310375 -0.03314415 -0.03318429 [55] -0.03322419 -0.03326384 -0.03330325 -0.03334240 -0.03338130 -0.03341996 [61] -0.03345836 -0.03349652 -0.03353443 -0.03357208 -0.03360948 -0.03364664 [67] -0.03368354 -0.03372018 -0.03375658 -0.03379272 -0.03382862 -0.03386425 [73] -0.03389964 -0.03393477 -0.03396965 -0.03400427 -0.03403864 -0.03407275 [79] -0.03410661 -0.03414021 -0.03417356 -0.03420665 -0.03423949 -0.03427206 [85] -0.03430439 -0.03433645 -0.03436826 -0.03439981 -0.03443110 -0.03446213 [91] -0.03449291 -0.03452343 -0.03455368 -0.03458368 -0.03461342 -0.03464290 [97] -0.03467212 -0.03470108 -0.03472978 -0.03475822 -0.03478640 -0.03481432 [103] -0.03484197 -0.03486937 -0.03489650 -0.03492337 -0.03494998 -0.03497632 [109] -0.03500241 -0.03502823 -0.03505378 -0.03507908 -0.03510411 -0.03512887 [115] -0.03515337 -0.03517761 -0.03520158 -0.03522529 -0.03524874 -0.03527192 [121] -0.03529483 -0.03531748 -0.03533986 -0.03536198 -0.03538383 -0.03540541 [127] -0.03542673 -0.03544778 -0.03546857 -0.03548909 -0.03550934 -0.03552932 [133] -0.03554904 -0.03556848 -0.03558766 -0.03560658 -0.03562522 -0.03564360 [139] -0.03566171 -0.03567954 -0.03569711 -0.03571442 -0.03573145 -0.03574821 [145] -0.03576470 -0.03578093 -0.03579688 -0.03581257 -0.03582798 -0.03584313 [151] -0.03585800 -0.03587260 -0.03588694 -0.03590100 -0.03591479 -0.03592831 [157] -0.03594156 -0.03595454 -0.03596725 -0.03597969 -0.03599185 -0.03600375 [163] -0.03601537 -0.03602672 -0.03603779 -0.03604860 -0.03605913 -0.03606940 [169] -0.03607939 -0.03608910 -0.03609855 -0.03610772 -0.03611662 -0.03612524 [175] -0.03613360 -0.03614168 -0.03614949 -0.03615702 -0.03616428 -0.03617127 [181] -0.03617799 -0.03618443 -0.03619060 -0.03619649 -0.03620211 -0.03620746 [187] -0.03621253 -0.03621733 -0.03622186 -0.03622611 -0.03623009 -0.03623380 [193] -0.03623723 -0.03624039 -0.03624327 -0.03624588 -0.03624821 -0.03625027 [199] -0.03625206 -0.03625357 -0.03625481 -0.03625578 -0.03625647 -0.03625688 [205] -0.03625703 -0.03625689 -0.03625649 -0.03625580 -0.03625485 -0.03625362 [211] -0.03625212 -0.03625034 -0.03624828 -0.03624596 -0.03624336 -0.03624048 [217] -0.03623733 -0.03623391 -0.03623021 -0.03622624 -0.03622199 -0.03621747 [223] -0.03621268 -0.03620761 -0.03620226 -0.03619665 -0.03619076 -0.03618459 [229] -0.03617815 -0.03617144 -0.03616445 -0.03615719 -0.03614966 -0.03614185 [235] -0.03613377 -0.03612542 -0.03611679 -0.03610789 -0.03609871 -0.03608926 [241] -0.03607954 -0.03606955 -0.03605928 -0.03604874 -0.03603792 -0.03602684 [247] -0.03601548 -0.03600384 -0.03599194 -0.03597976 -0.03596731 -0.03595459 [253] -0.03594159 -0.03592833 -0.03591479 -0.03590098 -0.03588689 -0.03587254 [259] -0.03585791 -0.03584302 -0.03582785 -0.03581241 -0.03579670 -0.03578071 [265] -0.03576446 -0.03574793 -0.03573114 -0.03571407 -0.03569674 -0.03567913 [271] -0.03566125 -0.03564311 -0.03562469 -0.03560600 -0.03558705 -0.03556782 [277] -0.03554833 -0.03552856 -0.03550853 -0.03548823 -0.03546766 -0.03544682 [283] -0.03542571 -0.03540434 -0.03538269 -0.03536078 -0.03533860 -0.03531616 [289] -0.03529344 -0.03527046 -0.03524721 -0.03522370 -0.03519991 -0.03517587 [295] -0.03515155 -0.03512697 -0.03510212 -0.03507701 -0.03505163 -0.03502599 [301] -0.03500008 -0.03497391 -0.03494747 -0.03492077 -0.03489380 -0.03486657 [307] -0.03483908 -0.03481132 -0.03478330 -0.03475501 -0.03472647 -0.03469766 [313] -0.03466858 -0.03463925 -0.03460965 -0.03457979 -0.03454967 -0.03451929 [319] -0.03448864 -0.03445774 -0.03442657 -0.03439515 -0.03436346 -0.03433152 [325] -0.03429931 -0.03426685 -0.03423413 -0.03420114 -0.03416790 -0.03413440 [331] -0.03410065 -0.03406663 -0.03403236 -0.03399783 -0.03396304 -0.03392800 [337] -0.03389270 -0.03385714 -0.03382133 -0.03378526 -0.03374893 -0.03371236 [343] -0.03367552 -0.03363843 -0.03360109 -0.03356350 -0.03352565 -0.03348754 [349] -0.03344919 -0.03341058 -0.03337172 -0.03333260 -0.03329324 -0.03325362 [355] -0.03321375 -0.03317364 -0.03313327 -0.03309265 -0.03305178 -0.03301066 [361] -0.03296929 -0.03292767 -0.03288581 -0.03284369 -0.03280133 -0.03275872 [367] -0.03271586 -0.03267276 -0.03262941 -0.03258581 -0.03254197 -0.03249788 [373] -0.03245354 -0.03240897 -0.03236414 -0.03231907 -0.03227376 -0.03222821 [379] -0.03218241 -0.03213637 -0.03209008 -0.03204356 -0.03199679 -0.03194978 [385] -0.03190253 -0.03185504 -0.03180731 -0.03175934 -0.03171113 -0.03166268 [391] -0.03161399 -0.03156506 -0.03151590 -0.03146650 -0.03141686 -0.03136698 [397] -0.03131687 -0.03126652 -0.03121593 -0.03116511 -0.03111406 > mx [1] 0.03625703 > mxli [1] 0.04 > 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/1frg01229106442.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/27d961229106442.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/3onyq1229106442.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/4o21i1229106442.tab") > > system("convert tmp/1frg01229106442.ps tmp/1frg01229106442.png") > system("convert tmp/27d961229106442.ps tmp/27d961229106442.png") > system("convert tmp/3onyq1229106442.ps tmp/3onyq1229106442.png") > > > proc.time() user system elapsed 1.243 0.831 1.390