R version 2.7.2 (2008-08-25) 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(63.3,102.9,107.6,93,84.1,89.7,90.1,103.4,95.6,90.4,104.1,82.8,69,105.1,104.3,95.4,93,89.3,85.2,96.4,93.1,83.3,98.4,76.9,66.3,98.6,92.3,96.1,84.4,85.8,94.6,101.5,86,91.1,101.8,79.4,67.3,98.1,104.7,102.9,82.8,94.5,93.1,103.6,89.9,92.5,103.5,86.9,69.5,97.1,109.8,96.6,75.8,127.5,93.4,87.7,94,84,90.1,81.5,58.6) > x <- c(9.4,9.5,9.1,9,9.3,9.9,9.8,9.4,8.3,8,8.5,10.4,11.1,10.9,9.9,9.2,9.2,9.5,9.6,9.5,9.1,8.9,9,10.1,10.3,10.2,9.6,9.2,9.3,9.4,9.4,9.2,9,9,9,9.8,10,9.9,9.3,9,9,9.1,9.1,9.1,9.2,8.8,8.3,8.4,8.1,7.8,7.9,7.9,8,7.9,7.5,7.2,6.9,6.6,6.7,7.3,7.5) > #'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.01912734 -0.01930386 -0.01948050 -0.01965726 -0.01983414 -0.02001113 [7] -0.02018825 -0.02036547 -0.02054282 -0.02072027 -0.02089785 -0.02107554 [13] -0.02125334 -0.02143126 -0.02160929 -0.02178743 -0.02196569 -0.02214405 [19] -0.02232253 -0.02250113 -0.02267983 -0.02285864 -0.02303757 -0.02321660 [25] -0.02339574 -0.02357499 -0.02375435 -0.02393382 -0.02411340 -0.02429308 [31] -0.02447287 -0.02465277 -0.02483277 -0.02501288 -0.02519309 -0.02537341 [37] -0.02555383 -0.02573436 -0.02591498 -0.02609572 -0.02627655 -0.02645749 [43] -0.02663853 -0.02681967 -0.02700091 -0.02718225 -0.02736369 -0.02754523 [49] -0.02772687 -0.02790861 -0.02809044 -0.02827237 -0.02845441 -0.02863653 [55] -0.02881876 -0.02900108 -0.02918349 -0.02936600 -0.02954861 -0.02973131 [61] -0.02991410 -0.03009699 -0.03027997 -0.03046304 -0.03064620 -0.03082945 [67] -0.03101280 -0.03119624 -0.03137976 -0.03156338 -0.03174708 -0.03193087 [73] -0.03211476 -0.03229872 -0.03248278 -0.03266692 -0.03285115 -0.03303547 [79] -0.03321987 -0.03340436 -0.03358893 -0.03377358 -0.03395832 -0.03414314 [85] -0.03432804 -0.03451303 -0.03469810 -0.03488324 -0.03506847 -0.03525378 [91] -0.03543917 -0.03562464 -0.03581019 -0.03599581 -0.03618152 -0.03636730 [97] -0.03655316 -0.03673909 -0.03692510 -0.03711119 -0.03729735 -0.03748358 [103] -0.03766989 -0.03785627 -0.03804273 -0.03822926 -0.03841586 -0.03860253 [109] -0.03878927 -0.03897608 -0.03916297 -0.03934992 -0.03953694 -0.03972403 [115] -0.03991119 -0.04009842 -0.04028571 -0.04047307 -0.04066050 -0.04084799 [121] -0.04103555 -0.04122317 -0.04141086 -0.04159861 -0.04178642 -0.04197430 [127] -0.04216223 -0.04235023 -0.04253829 -0.04272642 -0.04291460 -0.04310284 [133] -0.04329114 -0.04347950 -0.04366791 -0.04385639 -0.04404492 -0.04423351 [139] -0.04442216 -0.04461086 -0.04479961 -0.04498842 -0.04517729 -0.04536620 [145] -0.04555518 -0.04574420 -0.04593327 -0.04612240 -0.04631158 -0.04650081 [151] -0.04669009 -0.04687942 -0.04706879 -0.04725822 -0.04744769 -0.04763721 [157] -0.04782678 -0.04801640 -0.04820606 -0.04839576 -0.04858551 -0.04877531 [163] -0.04896515 -0.04915503 -0.04934495 -0.04953492 -0.04972493 -0.04991498 [169] -0.05010507 -0.05029520 -0.05048537 -0.05067558 -0.05086583 -0.05105611 [175] -0.05124643 -0.05143679 -0.05162719 -0.05181762 -0.05200809 -0.05219860 [181] -0.05238913 -0.05257971 -0.05277031 -0.05296095 -0.05315162 -0.05334232 [187] -0.05353305 -0.05372382 -0.05391461 -0.05410543 -0.05429628 -0.05448716 [193] -0.05467807 -0.05486901 -0.05505997 -0.05525096 -0.05544198 -0.05563302 [199] -0.05582408 -0.05601517 -0.05620629 -0.05639742 -0.05658858 -0.05677977 [205] -0.05697097 -0.05716219 -0.05735344 -0.05754470 -0.05773599 -0.05792729 [211] -0.05811861 -0.05830995 -0.05850131 -0.05869268 -0.05888407 -0.05907548 [217] -0.05926690 -0.05945833 -0.05964978 -0.05984124 -0.06003272 -0.06022421 [223] -0.06041571 -0.06060722 -0.06079874 -0.06099027 -0.06118182 -0.06137337 [229] -0.06156493 -0.06175649 -0.06194807 -0.06213965 -0.06233124 -0.06252284 [235] -0.06271444 -0.06290604 -0.06309765 -0.06328927 -0.06348088 -0.06367250 [241] -0.06386412 -0.06405575 -0.06424737 -0.06443900 -0.06463062 -0.06482225 [247] -0.06501387 -0.06520549 -0.06539711 -0.06558873 -0.06578034 -0.06597195 [253] -0.06616355 -0.06635515 -0.06654675 -0.06673834 -0.06692992 -0.06712149 [259] -0.06731306 -0.06750462 -0.06769617 -0.06788771 -0.06807924 -0.06827076 [265] -0.06846227 -0.06865377 -0.06884525 -0.06903673 -0.06922819 -0.06941963 [271] -0.06961107 -0.06980249 -0.06999389 -0.07018527 -0.07037664 -0.07056800 [277] -0.07075933 -0.07095065 -0.07114195 -0.07133323 -0.07152449 -0.07171573 [283] -0.07190695 -0.07209815 -0.07228933 -0.07248048 -0.07267161 -0.07286272 [289] -0.07305380 -0.07324486 -0.07343589 -0.07362690 -0.07381788 -0.07400884 [295] -0.07419977 -0.07439067 -0.07458154 -0.07477238 -0.07496320 -0.07515398 [301] -0.07534473 -0.07553545 -0.07572614 -0.07591680 -0.07610743 -0.07629802 [307] -0.07648858 -0.07667910 -0.07686959 -0.07706004 -0.07725046 -0.07744084 [313] -0.07763119 -0.07782149 -0.07801176 -0.07820199 -0.07839218 -0.07858233 [319] -0.07877244 -0.07896251 -0.07915254 -0.07934252 -0.07953247 -0.07972237 [325] -0.07991223 -0.08010204 -0.08029181 -0.08048153 -0.08067121 -0.08086084 [331] -0.08105042 -0.08123996 -0.08142945 -0.08161889 -0.08180828 -0.08199763 [337] -0.08218692 -0.08237616 -0.08256535 -0.08275449 -0.08294358 -0.08313262 [343] -0.08332160 -0.08351053 -0.08369940 -0.08388822 -0.08407698 -0.08426569 [349] -0.08445434 -0.08464294 -0.08483148 -0.08501995 -0.08520838 -0.08539674 [355] -0.08558504 -0.08577328 -0.08596146 -0.08614959 -0.08633764 -0.08652564 [361] -0.08671358 -0.08690145 -0.08708925 -0.08727700 -0.08746467 -0.08765229 [367] -0.08783983 -0.08802732 -0.08821473 -0.08840208 -0.08858935 -0.08877656 [373] -0.08896371 -0.08915078 -0.08933778 -0.08952471 -0.08971157 -0.08989836 [379] -0.09008507 -0.09027172 -0.09045829 -0.09064479 -0.09083121 -0.09101756 [385] -0.09120383 -0.09139003 -0.09157615 -0.09176219 -0.09194816 -0.09213405 [391] -0.09231986 -0.09250559 -0.09269125 -0.09287682 -0.09306231 -0.09324773 [397] -0.09343306 -0.09361831 -0.09380347 -0.09398856 -0.09417356 > mx [1] 0.09417356 > 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/1hcl51226610794.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/2mdza1226610794.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/323051226610794.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/4jo4b1226610794.tab") > > system("convert tmp/1hcl51226610794.ps tmp/1hcl51226610794.png") > system("convert tmp/2mdza1226610794.ps tmp/2mdza1226610794.png") > system("convert tmp/323051226610794.ps tmp/323051226610794.png") > > > proc.time() user system elapsed 1.019 0.525 2.124