R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(11495,13964,15751,16662,16913,17017,18704,18901,18123,17789,17268,24042,13671,15698,18150,16245,18479,18479,18819,18059,17004,16981,16578,21604,13419,14487,17349,15646,17419,17358,18221,19554,14386,16833,18067,19662,12192,15081,13698,18474,13871,15669,17597,15469,15374,16568,11619,16780,8700,8906,9612,10073,10275,9921,13237,9572,10425,11385,9970,15456) > x <- c(493,514,522,490,484,506,501,462,465,454,464,427,460,473,465,422,415,413,420,363,376,380,384,346,389,407,393,346,348,353,364,305,307,312,312,286,324,336,327,302,299,311,315,264,278,278,287,279,324,354,354,360,363,385,412,370,389,395,417,404) > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = '' > par2 = '' > par1 = 'pearson' > ylab = '' > xlab = '' > main = '' > #'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.04714888 0.04733016 0.04751147 0.04769279 0.04787414 0.04805549 [7] 0.04823687 0.04841826 0.04859966 0.04878107 0.04896250 0.04914394 [13] 0.04932538 0.04950684 0.04968830 0.04986976 0.05005123 0.05023271 [19] 0.05041419 0.05059566 0.05077714 0.05095862 0.05114010 0.05132157 [25] 0.05150304 0.05168450 0.05186596 0.05204741 0.05222885 0.05241028 [31] 0.05259170 0.05277311 0.05295451 0.05313589 0.05331726 0.05349861 [37] 0.05367994 0.05386125 0.05404255 0.05422382 0.05440507 0.05458630 [43] 0.05476750 0.05494867 0.05512983 0.05531095 0.05549204 0.05567311 [49] 0.05585414 0.05603514 0.05621611 0.05639704 0.05657793 0.05675879 [55] 0.05693961 0.05712040 0.05730114 0.05748184 0.05766250 0.05784311 [61] 0.05802368 0.05820420 0.05838468 0.05856511 0.05874548 0.05892581 [67] 0.05910609 0.05928631 0.05946648 0.05964659 0.05982665 0.06000665 [73] 0.06018659 0.06036647 0.06054629 0.06072605 0.06090574 0.06108537 [79] 0.06126493 0.06144443 0.06162386 0.06180322 0.06198251 0.06216173 [85] 0.06234088 0.06251995 0.06269895 0.06287787 0.06305672 0.06323548 [91] 0.06341417 0.06359278 0.06377130 0.06394974 0.06412810 0.06430638 [97] 0.06448456 0.06466266 0.06484067 0.06501859 0.06519642 0.06537416 [103] 0.06555180 0.06572936 0.06590681 0.06608417 0.06626143 0.06643859 [109] 0.06661565 0.06679261 0.06696947 0.06714622 0.06732287 0.06749942 [115] 0.06767585 0.06785218 0.06802840 0.06820451 0.06838051 0.06855639 [121] 0.06873216 0.06890782 0.06908336 0.06925878 0.06943409 0.06960927 [127] 0.06978434 0.06995928 0.07013410 0.07030879 0.07048337 0.07065781 [133] 0.07083213 0.07100632 0.07118038 0.07135430 0.07152810 0.07170176 [139] 0.07187529 0.07204869 0.07222195 0.07239507 0.07256805 0.07274089 [145] 0.07291359 0.07308615 0.07325857 0.07343084 0.07360297 0.07377495 [151] 0.07394678 0.07411847 0.07429000 0.07446139 0.07463262 0.07480370 [157] 0.07497463 0.07514540 0.07531601 0.07548647 0.07565677 0.07582691 [163] 0.07599689 0.07616671 0.07633636 0.07650585 0.07667518 0.07684434 [169] 0.07701333 0.07718216 0.07735081 0.07751930 0.07768761 0.07785575 [175] 0.07802372 0.07819152 0.07835914 0.07852658 0.07869384 0.07886093 [181] 0.07902784 0.07919456 0.07936110 0.07952747 0.07969364 0.07985963 [187] 0.08002544 0.08019106 0.08035649 0.08052173 0.08068678 0.08085164 [193] 0.08101631 0.08118079 0.08134507 0.08150915 0.08167304 0.08183674 [199] 0.08200023 0.08216352 0.08232662 0.08248951 0.08265220 0.08281469 [205] 0.08297697 0.08313905 0.08330092 0.08346259 0.08362405 0.08378529 [211] 0.08394633 0.08410716 0.08426777 0.08442817 0.08458836 0.08474833 [217] 0.08490809 0.08506763 0.08522695 0.08538605 0.08554493 0.08570359 [223] 0.08586203 0.08602025 0.08617825 0.08633602 0.08649356 0.08665088 [229] 0.08680797 0.08696483 0.08712146 0.08727787 0.08743404 0.08758998 [235] 0.08774569 0.08790116 0.08805640 0.08821140 0.08836617 0.08852070 [241] 0.08867499 0.08882904 0.08898286 0.08913643 0.08928976 0.08944285 [247] 0.08959569 0.08974829 0.08990065 0.09005275 0.09020462 0.09035623 [253] 0.09050760 0.09065871 0.09080958 0.09096019 0.09111055 0.09126066 [259] 0.09141052 0.09156012 0.09170947 0.09185856 0.09200739 0.09215597 [265] 0.09230428 0.09245234 0.09260014 0.09274768 0.09289495 0.09304196 [271] 0.09318871 0.09333520 0.09348142 0.09362737 0.09377306 0.09391848 [277] 0.09406363 0.09420851 0.09435313 0.09449747 0.09464154 0.09478534 [283] 0.09492887 0.09507213 0.09521511 0.09535781 0.09550025 0.09564240 [289] 0.09578428 0.09592588 0.09606720 0.09620824 0.09634900 0.09648949 [295] 0.09662969 0.09676961 0.09690924 0.09704860 0.09718767 0.09732645 [301] 0.09746495 0.09760316 0.09774109 0.09787873 0.09801608 0.09815314 [307] 0.09828992 0.09842640 0.09856259 0.09869849 0.09883410 0.09896942 [313] 0.09910445 0.09923918 0.09937361 0.09950775 0.09964160 0.09977515 [319] 0.09990840 0.10004135 0.10017401 0.10030637 0.10043843 0.10057019 [325] 0.10070165 0.10083280 0.10096366 0.10109421 0.10122446 0.10135441 [331] 0.10148406 0.10161340 0.10174243 0.10187116 0.10199958 0.10212770 [337] 0.10225551 0.10238301 0.10251021 0.10263709 0.10276367 0.10288994 [343] 0.10301589 0.10314154 0.10326687 0.10339190 0.10351661 0.10364100 [349] 0.10376509 0.10388886 0.10401232 0.10413546 0.10425829 0.10438080 [355] 0.10450299 0.10462487 0.10474644 0.10486768 0.10498861 0.10510922 [361] 0.10522951 0.10534948 0.10546913 0.10558846 0.10570748 0.10582617 [367] 0.10594454 0.10606258 0.10618031 0.10629771 0.10641479 0.10653155 [373] 0.10664799 0.10676410 0.10687988 0.10699534 0.10711048 0.10722529 [379] 0.10733978 0.10745393 0.10756777 0.10768127 0.10779445 0.10790730 [385] 0.10801982 0.10813202 0.10824388 0.10835542 0.10846663 0.10857751 [391] 0.10868806 0.10879827 0.10890816 0.10901772 0.10912695 0.10923584 [397] 0.10934441 0.10945264 0.10956054 0.10966810 0.10977534 > mx [1] 0.1097753 > 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/rcomp/tmp/1ycfe1293273024.ps",horizontal=F,onefile=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/rcomp/tmp/2ycfe1293273024.ps",horizontal=F,onefile=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/rcomp/tmp/3qlfg1293273024.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/4u4d41293273024.tab") > try(system("convert tmp/1ycfe1293273024.ps tmp/1ycfe1293273024.png",intern=TRUE)) character(0) > try(system("convert tmp/2ycfe1293273024.ps tmp/2ycfe1293273024.png",intern=TRUE)) character(0) > try(system("convert tmp/3qlfg1293273024.ps tmp/3qlfg1293273024.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 0.920 0.600 1.508