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(282965,276610,277838,277051,277026,274960,270073,267063,264916,287182,291109,292223,288109,281400,282579,280113,280331,276759,275139,274275,271234,289725,290649,292223,278429,269749,265784,268957,264099,255121,253276,245980,235295,258479,260916,254586,250566,243345,247028,248464,244962,237003,237008,225477,226762,247857,248256,246892,245021,246186,255688,264242,268270,272969,273886,267353,271916,292633,295804,293222) > x <- c(581000,597000,587000,536000,524000,537000,536000,533000,528000,516000,502000,506000,518000,534000,528000,478000,469000,490000,493000,508000,517000,514000,510000,527000,542000,565000,555000,499000,511000,526000,532000,549000,561000,557000,566000,588000,620000,626000,620000,573000,573000,574000,580000,590000,593000,597000,595000,612000,628000,629000,621000,569000,567000,573000,584000,589000,591000,595000,594000,611000) > #'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.4969988 -0.4970187 -0.4969987 -0.4970679 -0.4970772 -0.4971106 [7] -0.4971198 -0.4971460 -0.4971500 -0.4971686 -0.4971965 -0.4972055 [13] -0.4972246 -0.4972402 -0.4972613 -0.4972812 -0.4973039 -0.4973157 [19] -0.4973355 -0.4973536 -0.4973704 -0.4973883 -0.4974066 -0.4974232 [25] -0.4974413 -0.4974590 -0.4974761 -0.4974929 -0.4975099 -0.4975275 [31] -0.4975437 -0.4975611 -0.4975774 -0.4975944 -0.4976110 -0.4976274 [37] -0.4976435 -0.4976595 -0.4976760 -0.4976920 -0.4977081 -0.4977238 [43] -0.4977395 -0.4977554 -0.4977708 -0.4977864 -0.4978018 -0.4978171 [49] -0.4978323 -0.4978474 -0.4978625 -0.4978774 -0.4978923 -0.4979070 [55] -0.4979217 -0.4979363 -0.4979508 -0.4979652 -0.4979795 -0.4979937 [61] -0.4980078 -0.4980218 -0.4980357 -0.4980496 -0.4980633 -0.4980770 [67] -0.4980906 -0.4981040 -0.4981174 -0.4981307 -0.4981439 -0.4981570 [73] -0.4981701 -0.4981830 -0.4981958 -0.4982086 -0.4982212 -0.4982338 [79] -0.4982463 -0.4982587 -0.4982709 -0.4982831 -0.4982953 -0.4983073 [85] -0.4983192 -0.4983311 -0.4983428 -0.4983545 -0.4983660 -0.4983775 [91] -0.4983889 -0.4984002 -0.4984114 -0.4984225 -0.4984335 -0.4984445 [97] -0.4984553 -0.4984661 -0.4984767 -0.4984873 -0.4984978 -0.4985082 [103] -0.4985185 -0.4985287 -0.4985388 -0.4985489 -0.4985588 -0.4985687 [109] -0.4985784 -0.4985881 -0.4985977 -0.4986072 -0.4986166 -0.4986259 [115] -0.4986352 -0.4986443 -0.4986533 -0.4986623 -0.4986712 -0.4986800 [121] -0.4986887 -0.4986973 -0.4987058 -0.4987142 -0.4987225 -0.4987308 [127] -0.4987389 -0.4987470 -0.4987550 -0.4987629 -0.4987707 -0.4987784 [133] -0.4987860 -0.4987936 -0.4988010 -0.4988084 -0.4988157 -0.4988229 [139] -0.4988300 -0.4988370 -0.4988439 -0.4988507 -0.4988575 -0.4988641 [145] -0.4988707 -0.4988772 -0.4988836 -0.4988899 -0.4988961 -0.4989022 [151] -0.4989083 -0.4989142 -0.4989201 -0.4989259 -0.4989315 -0.4989371 [157] -0.4989427 -0.4989481 -0.4989534 -0.4989587 -0.4989639 -0.4989689 [163] -0.4989739 -0.4989788 -0.4989837 -0.4989884 -0.4989930 -0.4989976 [169] -0.4990021 -0.4990064 -0.4990107 -0.4990149 -0.4990191 -0.4990231 [175] -0.4990271 -0.4990309 -0.4990347 -0.4990384 -0.4990420 -0.4990455 [181] -0.4990490 -0.4990523 -0.4990556 -0.4990587 -0.4990618 -0.4990648 [187] -0.4990677 -0.4990706 -0.4990733 -0.4990760 -0.4990786 -0.4990810 [193] -0.4990834 -0.4990858 -0.4990880 -0.4990901 -0.4990922 -0.4990942 [199] -0.4990961 -0.4990979 -0.4990996 -0.4991012 -0.4991028 -0.4991042 [205] -0.4991056 -0.4991069 -0.4991081 -0.4991092 -0.4991103 -0.4991112 [211] -0.4991121 -0.4991129 -0.4991136 -0.4991142 -0.4991147 -0.4991152 [217] -0.4991155 -0.4991158 -0.4991160 -0.4991161 -0.4991162 -0.4991161 [223] -0.4991160 -0.4991157 -0.4991154 -0.4991150 -0.4991146 -0.4991140 [229] -0.4991134 -0.4991126 -0.4991118 -0.4991109 -0.4991099 -0.4991089 [235] -0.4991077 -0.4991065 -0.4991052 -0.4991038 -0.4991023 -0.4991008 [241] -0.4990991 -0.4990974 -0.4990956 -0.4990937 -0.4990917 -0.4990897 [247] -0.4990875 -0.4990853 -0.4990830 -0.4990806 -0.4990781 -0.4990756 [253] -0.4990729 -0.4990702 -0.4990674 -0.4990645 -0.4990616 -0.4990585 [259] -0.4990554 -0.4990522 -0.4990489 -0.4990455 -0.4990421 -0.4990385 [265] -0.4990349 -0.4990312 -0.4990274 -0.4990236 -0.4990196 -0.4990156 [271] -0.4990115 -0.4990073 -0.4990030 -0.4989987 -0.4989943 -0.4989897 [277] -0.4989852 -0.4989805 -0.4989757 -0.4989709 -0.4989660 -0.4989610 [283] -0.4989559 -0.4989507 -0.4989455 -0.4989402 -0.4989348 -0.4989293 [289] -0.4989237 -0.4989181 -0.4989124 -0.4989066 -0.4989007 -0.4988947 [295] -0.4988887 -0.4988826 -0.4988764 -0.4988701 -0.4988638 -0.4988573 [301] -0.4988508 -0.4988442 -0.4988375 -0.4988308 -0.4988239 -0.4988170 [307] -0.4988100 -0.4988030 -0.4987958 -0.4987886 -0.4987813 -0.4987739 [313] -0.4987664 -0.4987589 -0.4987512 -0.4987435 -0.4987358 -0.4987279 [319] -0.4987200 -0.4987120 -0.4987039 -0.4986957 -0.4986874 -0.4986791 [325] -0.4986707 -0.4986622 -0.4986537 -0.4986450 -0.4986363 -0.4986275 [331] -0.4986186 -0.4986097 -0.4986007 -0.4985916 -0.4985824 -0.4985731 [337] -0.4985638 -0.4985544 -0.4985449 -0.4985353 -0.4985257 -0.4985159 [343] -0.4985061 -0.4984963 -0.4984863 -0.4984763 -0.4984662 -0.4984560 [349] -0.4984457 -0.4984354 -0.4984250 -0.4984145 -0.4984039 -0.4983933 [355] -0.4983826 -0.4983718 -0.4983609 -0.4983500 -0.4983390 -0.4983279 [361] -0.4983167 -0.4983054 -0.4982941 -0.4982827 -0.4982712 -0.4982597 [367] -0.4982481 -0.4982364 -0.4982246 -0.4982127 -0.4982008 -0.4981888 [373] -0.4981767 -0.4981646 -0.4981524 -0.4981401 -0.4981277 -0.4981153 [379] -0.4981027 -0.4980901 -0.4980775 -0.4980647 -0.4980519 -0.4980390 [385] -0.4980260 -0.4980130 -0.4979999 -0.4979867 -0.4979734 -0.4979601 [391] -0.4979467 -0.4979332 -0.4979196 -0.4979060 -0.4978923 -0.4978785 [397] -0.4978647 -0.4978507 -0.4978367 -0.4978227 -0.4978085 > mx [1] 0.4991162 > mxli [1] 0.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/freestat/rcomp/tmp/1yzrz1257812289.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/2sgik1257812289.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/3k8vz1257812289.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/465tv1257812289.tab") > system("convert tmp/1yzrz1257812289.ps tmp/1yzrz1257812289.png") > system("convert tmp/2sgik1257812289.ps tmp/2sgik1257812289.png") > system("convert tmp/3k8vz1257812289.ps tmp/3k8vz1257812289.png") > > > proc.time() user system elapsed 1.380 0.974 1.559