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(328282,317480,317539,313737,312276,309391,302950,300316,304035,333476,337698,335932,323931,313927,314485,313218,309664,302963,298989,298423,301631,329765,335083,327616,309119,295916,291413,291542,284678,276475,272566,264981,263290,296806,303598,286994,276427,266424,267153,268381,262522,255542,253158,243803,250741,280445,285257,270976,261076,255603,260376,263903,264291,263276,262572,256167,264221,293860,300713,287224) > x <- c(283042,276687,277915,277128,277103,275037,270150,267140,264993,287259,291186,292300,288186,281477,282656,280190,280408,276836,275216,274352,271311,289802,290726,292300,278506,269826,265861,269034,264176,255198,253353,246057,235372,258556,260993,254663,250643,243422,247105,248541,245039,237080,237085,225554,226839,247934,248333,246969,245098,246263,255765,264319,268347,273046,273963,267430,271993,292710,295881,293299) > #'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.7985612 0.7986104 0.7986595 0.7987066 0.7987563 0.7988064 0.7988550 [8] 0.7989032 0.7989523 0.7989997 0.7990496 0.7990975 0.7991453 0.7991925 [15] 0.7992408 0.7992872 0.7993355 0.7993822 0.7994292 0.7994762 0.7995233 [22] 0.7995704 0.7996170 0.7996634 0.7997098 0.7997561 0.7998025 0.7998488 [29] 0.7998945 0.7999405 0.7999862 0.8000318 0.8000773 0.8001227 0.8001679 [36] 0.8002131 0.8002581 0.8003030 0.8003478 0.8003925 0.8004370 0.8004814 [43] 0.8005257 0.8005699 0.8006140 0.8006579 0.8007017 0.8007454 0.8007890 [50] 0.8008325 0.8008759 0.8009191 0.8009622 0.8010052 0.8010481 0.8010908 [57] 0.8011334 0.8011759 0.8012183 0.8012606 0.8013028 0.8013448 0.8013867 [64] 0.8014285 0.8014702 0.8015117 0.8015532 0.8015945 0.8016357 0.8016768 [71] 0.8017177 0.8017586 0.8017993 0.8018399 0.8018803 0.8019207 0.8019609 [78] 0.8020011 0.8020411 0.8020810 0.8021207 0.8021604 0.8021999 0.8022393 [85] 0.8022786 0.8023177 0.8023568 0.8023957 0.8024345 0.8024732 0.8025118 [92] 0.8025502 0.8025885 0.8026267 0.8026648 0.8027028 0.8027407 0.8027784 [99] 0.8028160 0.8028535 0.8028909 0.8029281 0.8029652 0.8030023 0.8030392 [106] 0.8030759 0.8031126 0.8031491 0.8031855 0.8032218 0.8032580 0.8032941 [113] 0.8033300 0.8033658 0.8034015 0.8034371 0.8034726 0.8035079 0.8035432 [120] 0.8035783 0.8036133 0.8036481 0.8036829 0.8037175 0.8037520 0.8037864 [127] 0.8038207 0.8038548 0.8038889 0.8039228 0.8039566 0.8039902 0.8040238 [134] 0.8040572 0.8040906 0.8041238 0.8041568 0.8041898 0.8042226 0.8042554 [141] 0.8042880 0.8043204 0.8043528 0.8043851 0.8044172 0.8044492 0.8044811 [148] 0.8045129 0.8045445 0.8045760 0.8046075 0.8046388 0.8046699 0.8047010 [155] 0.8047319 0.8047627 0.8047934 0.8048240 0.8048545 0.8048848 0.8049151 [162] 0.8049452 0.8049752 0.8050050 0.8050348 0.8050644 0.8050939 0.8051233 [169] 0.8051526 0.8051818 0.8052108 0.8052397 0.8052685 0.8052972 0.8053258 [176] 0.8053542 0.8053826 0.8054108 0.8054389 0.8054668 0.8054947 0.8055224 [183] 0.8055500 0.8055775 0.8056049 0.8056322 0.8056593 0.8056863 0.8057133 [190] 0.8057400 0.8057667 0.8057933 0.8058197 0.8058460 0.8058722 0.8058983 [197] 0.8059243 0.8059501 0.8059758 0.8060014 0.8060269 0.8060523 0.8060776 [204] 0.8061027 0.8061277 0.8061526 0.8061774 0.8062021 0.8062266 0.8062510 [211] 0.8062753 0.8062995 0.8063236 0.8063476 0.8063714 0.8063951 0.8064187 [218] 0.8064422 0.8064656 0.8064888 0.8065120 0.8065350 0.8065579 0.8065807 [225] 0.8066033 0.8066259 0.8066483 0.8066706 0.8066928 0.8067149 0.8067369 [232] 0.8067587 0.8067804 0.8068020 0.8068235 0.8068449 0.8068661 0.8068873 [239] 0.8069083 0.8069292 0.8069500 0.8069707 0.8069912 0.8070116 0.8070320 [246] 0.8070522 0.8070722 0.8070922 0.8071121 0.8071318 0.8071514 0.8071709 [253] 0.8071903 0.8072096 0.8072287 0.8072477 0.8072667 0.8072855 0.8073041 [260] 0.8073227 0.8073412 0.8073595 0.8073777 0.8073958 0.8074138 0.8074316 [267] 0.8074494 0.8074670 0.8074845 0.8075019 0.8075192 0.8075364 0.8075535 [274] 0.8075704 0.8075872 0.8076039 0.8076205 0.8076370 0.8076533 0.8076696 [281] 0.8076857 0.8077017 0.8077176 0.8077333 0.8077490 0.8077646 0.8077800 [288] 0.8077953 0.8078105 0.8078256 0.8078405 0.8078554 0.8078701 0.8078847 [295] 0.8078992 0.8079136 0.8079279 0.8079420 0.8079561 0.8079700 0.8079838 [302] 0.8079975 0.8080111 0.8080245 0.8080379 0.8080511 0.8080642 0.8080772 [309] 0.8080901 0.8081029 0.8081155 0.8081281 0.8081405 0.8081528 0.8081650 [316] 0.8081771 0.8081891 0.8082009 0.8082126 0.8082243 0.8082358 0.8082472 [323] 0.8082584 0.8082696 0.8082806 0.8082916 0.8083024 0.8083131 0.8083237 [330] 0.8083342 0.8083445 0.8083548 0.8083649 0.8083749 0.8083848 0.8083946 [337] 0.8084043 0.8084138 0.8084233 0.8084326 0.8084418 0.8084509 0.8084599 [344] 0.8084688 0.8084776 0.8084862 0.8084947 0.8085032 0.8085115 0.8085197 [351] 0.8085277 0.8085357 0.8085436 0.8085513 0.8085589 0.8085664 0.8085738 [358] 0.8085811 0.8085883 0.8085953 0.8086023 0.8086091 0.8086158 0.8086224 [365] 0.8086289 0.8086353 0.8086416 0.8086477 0.8086538 0.8086597 0.8086655 [372] 0.8086712 0.8086768 0.8086823 0.8086876 0.8086929 0.8086980 0.8087030 [379] 0.8087080 0.8087128 0.8087174 0.8087220 0.8087265 0.8087308 0.8087351 [386] 0.8087392 0.8087432 0.8087471 0.8087509 0.8087546 0.8087581 0.8087616 [393] 0.8087649 0.8087681 0.8087712 0.8087743 0.8087771 0.8087799 0.8087826 [400] 0.8087851 0.8087876 > mx [1] 0.8087876 > 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/19nl71257931937.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/24v231257931937.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/3n1s21257931937.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/4stws1257931938.tab") > > system("convert tmp/19nl71257931937.ps tmp/19nl71257931937.png") > system("convert tmp/24v231257931937.ps tmp/24v231257931937.png") > system("convert tmp/3n1s21257931937.ps tmp/3n1s21257931937.png") > > > proc.time() user system elapsed 0.767 0.492 0.956