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(269645,267037,258113,262813,267413,267366,264777,258863,254844,254868,277267,285351,286602,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) > x <- c(308347,298427,289231,291975,294912,293488,290555,284736,281818,287854,316263,325412,326011,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) > #'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.8266160 0.8266530 0.8266906 0.8267262 0.8267640 0.8267989 0.8268316 [8] 0.8268686 0.8269025 0.8269396 0.8269753 0.8270110 0.8270472 0.8270815 [15] 0.8271163 0.8271510 0.8271864 0.8272204 0.8272555 0.8272897 0.8273239 [22] 0.8273582 0.8273924 0.8274263 0.8274604 0.8274939 0.8275277 0.8275612 [29] 0.8275946 0.8276280 0.8276613 0.8276945 0.8277274 0.8277602 0.8277930 [36] 0.8278256 0.8278582 0.8278906 0.8279229 0.8279551 0.8279872 0.8280192 [43] 0.8280511 0.8280828 0.8281144 0.8281460 0.8281774 0.8282086 0.8282398 [50] 0.8282709 0.8283018 0.8283327 0.8283634 0.8283940 0.8284245 0.8284548 [57] 0.8284851 0.8285152 0.8285453 0.8285752 0.8286050 0.8286347 0.8286642 [64] 0.8286937 0.8287230 0.8287522 0.8287813 0.8288103 0.8288392 0.8288679 [71] 0.8288966 0.8289251 0.8289535 0.8289818 0.8290100 0.8290380 0.8290660 [78] 0.8290938 0.8291215 0.8291491 0.8291766 0.8292039 0.8292311 0.8292583 [85] 0.8292853 0.8293122 0.8293389 0.8293656 0.8293921 0.8294185 0.8294448 [92] 0.8294710 0.8294971 0.8295230 0.8295488 0.8295745 0.8296001 0.8296256 [99] 0.8296509 0.8296762 0.8297013 0.8297263 0.8297512 0.8297759 0.8298006 [106] 0.8298251 0.8298495 0.8298738 0.8298979 0.8299220 0.8299459 0.8299697 [113] 0.8299934 0.8300169 0.8300404 0.8300637 0.8300869 0.8301100 0.8301330 [120] 0.8301558 0.8301785 0.8302012 0.8302236 0.8302460 0.8302682 0.8302904 [127] 0.8303124 0.8303343 0.8303560 0.8303777 0.8303992 0.8304206 0.8304418 [134] 0.8304630 0.8304840 0.8305050 0.8305257 0.8305464 0.8305670 0.8305874 [141] 0.8306077 0.8306279 0.8306480 0.8306679 0.8306877 0.8307074 0.8307270 [148] 0.8307464 0.8307658 0.8307850 0.8308041 0.8308230 0.8308419 0.8308606 [155] 0.8308792 0.8308977 0.8309160 0.8309342 0.8309524 0.8309703 0.8309882 [162] 0.8310059 0.8310235 0.8310410 0.8310584 0.8310756 0.8310928 0.8311098 [169] 0.8311266 0.8311434 0.8311600 0.8311765 0.8311929 0.8312092 0.8312253 [176] 0.8312413 0.8312572 0.8312729 0.8312886 0.8313041 0.8313195 0.8313347 [183] 0.8313499 0.8313649 0.8313798 0.8313945 0.8314092 0.8314237 0.8314381 [190] 0.8314523 0.8314665 0.8314805 0.8314944 0.8315082 0.8315218 0.8315353 [197] 0.8315487 0.8315620 0.8315751 0.8315881 0.8316010 0.8316138 0.8316264 [204] 0.8316389 0.8316513 0.8316636 0.8316757 0.8316877 0.8316996 0.8317114 [211] 0.8317230 0.8317345 0.8317459 0.8317571 0.8317683 0.8317793 0.8317901 [218] 0.8318009 0.8318115 0.8318220 0.8318324 0.8318426 0.8318527 0.8318627 [225] 0.8318726 0.8318823 0.8318919 0.8319014 0.8319108 0.8319200 0.8319291 [232] 0.8319381 0.8319469 0.8319556 0.8319642 0.8319727 0.8319810 0.8319892 [239] 0.8319973 0.8320053 0.8320131 0.8320208 0.8320284 0.8320358 0.8320431 [246] 0.8320503 0.8320574 0.8320643 0.8320711 0.8320778 0.8320844 0.8320908 [253] 0.8320971 0.8321033 0.8321093 0.8321152 0.8321210 0.8321266 0.8321322 [260] 0.8321376 0.8321428 0.8321480 0.8321530 0.8321579 0.8321626 0.8321672 [267] 0.8321717 0.8321761 0.8321804 0.8321845 0.8321884 0.8321923 0.8321960 [274] 0.8321996 0.8322031 0.8322064 0.8322096 0.8322127 0.8322157 0.8322185 [281] 0.8322212 0.8322237 0.8322262 0.8322285 0.8322307 0.8322327 0.8322346 [288] 0.8322364 0.8322381 0.8322396 0.8322410 0.8322423 0.8322434 0.8322444 [295] 0.8322453 0.8322461 0.8322467 0.8322472 0.8322475 0.8322478 0.8322479 [302] 0.8322478 0.8322477 0.8322474 0.8322470 0.8322464 0.8322458 0.8322449 [309] 0.8322440 0.8322429 0.8322417 0.8322404 0.8322390 0.8322374 0.8322357 [316] 0.8322338 0.8322318 0.8322297 0.8322275 0.8322251 0.8322226 0.8322200 [323] 0.8322172 0.8322143 0.8322113 0.8322082 0.8322049 0.8322015 0.8321979 [330] 0.8321943 0.8321904 0.8321865 0.8321824 0.8321782 0.8321739 0.8321695 [337] 0.8321649 0.8321602 0.8321553 0.8321503 0.8321452 0.8321400 0.8321346 [344] 0.8321291 0.8321235 0.8321177 0.8321118 0.8321058 0.8320996 0.8320933 [351] 0.8320869 0.8320803 0.8320737 0.8320669 0.8320599 0.8320528 0.8320456 [358] 0.8320383 0.8320308 0.8320232 0.8320155 0.8320076 0.8319996 0.8319915 [365] 0.8319833 0.8319749 0.8319663 0.8319577 0.8319489 0.8319400 0.8319310 [372] 0.8319218 0.8319125 0.8319030 0.8318935 0.8318838 0.8318739 0.8318640 [379] 0.8318539 0.8318437 0.8318333 0.8318228 0.8318122 0.8318015 0.8317906 [386] 0.8317796 0.8317684 0.8317571 0.8317457 0.8317342 0.8317225 0.8317107 [393] 0.8316988 0.8316867 0.8316745 0.8316622 0.8316498 0.8316372 0.8316244 [400] 0.8316116 0.8315986 > mx [1] 0.8322479 > mxli [1] 1 > 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/11nlp1257902052.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/2ol0n1257902052.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/3j4cs1257902052.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/4xls11257902052.tab") > > system("convert tmp/11nlp1257902052.ps tmp/11nlp1257902052.png") > system("convert tmp/2ol0n1257902052.ps tmp/2ol0n1257902052.png") > system("convert tmp/3j4cs1257902052.ps tmp/3j4cs1257902052.png") > > > proc.time() user system elapsed 0.776 0.502 1.500