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(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) > x <- c(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) > #'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.8283826 0.8284554 0.8285272 0.8285970 0.8286702 0.8287430 0.8288149 [8] 0.8288855 0.8289571 0.8290278 0.8291004 0.8291708 0.8292418 0.8293124 [15] 0.8293837 0.8294531 0.8295244 0.8295943 0.8296644 0.8297343 0.8298047 [22] 0.8298747 0.8299443 0.8300139 0.8300834 0.8301530 0.8302225 0.8302919 [29] 0.8303608 0.8304299 0.8304987 0.8305675 0.8306362 0.8307048 0.8307732 [36] 0.8308416 0.8309098 0.8309779 0.8310460 0.8311140 0.8311817 0.8312494 [43] 0.8313170 0.8313844 0.8314518 0.8315190 0.8315862 0.8316532 0.8317201 [50] 0.8317869 0.8318536 0.8319202 0.8319867 0.8320530 0.8321193 0.8321854 [57] 0.8322515 0.8323174 0.8323832 0.8324489 0.8325145 0.8325800 0.8326453 [64] 0.8327106 0.8327757 0.8328408 0.8329057 0.8329705 0.8330352 0.8330998 [71] 0.8331643 0.8332287 0.8332929 0.8333571 0.8334211 0.8334850 0.8335489 [78] 0.8336126 0.8336762 0.8337397 0.8338030 0.8338663 0.8339295 0.8339925 [85] 0.8340555 0.8341183 0.8341810 0.8342436 0.8343061 0.8343685 0.8344308 [92] 0.8344929 0.8345550 0.8346169 0.8346788 0.8347405 0.8348021 0.8348636 [99] 0.8349250 0.8349863 0.8350474 0.8351085 0.8351695 0.8352303 0.8352910 [106] 0.8353517 0.8354122 0.8354726 0.8355329 0.8355930 0.8356531 0.8357131 [113] 0.8357729 0.8358327 0.8358923 0.8359518 0.8360112 0.8360705 0.8361297 [120] 0.8361888 0.8362477 0.8363066 0.8363653 0.8364240 0.8364825 0.8365409 [127] 0.8365992 0.8366574 0.8367155 0.8367735 0.8368314 0.8368891 0.8369468 [134] 0.8370043 0.8370617 0.8371191 0.8371763 0.8372334 0.8372904 0.8373472 [141] 0.8374040 0.8374607 0.8375172 0.8375737 0.8376300 0.8376862 0.8377423 [148] 0.8377983 0.8378542 0.8379100 0.8379657 0.8380212 0.8380767 0.8381320 [155] 0.8381872 0.8382424 0.8382974 0.8383523 0.8384071 0.8384618 0.8385163 [162] 0.8385708 0.8386252 0.8386794 0.8387335 0.8387876 0.8388415 0.8388953 [169] 0.8389490 0.8390026 0.8390561 0.8391094 0.8391627 0.8392158 0.8392689 [176] 0.8393218 0.8393746 0.8394274 0.8394800 0.8395325 0.8395849 0.8396371 [183] 0.8396893 0.8397414 0.8397933 0.8398452 0.8398969 0.8399485 0.8400000 [190] 0.8400514 0.8401027 0.8401539 0.8402050 0.8402560 0.8403068 0.8403576 [197] 0.8404082 0.8404587 0.8405092 0.8405595 0.8406097 0.8406598 0.8407098 [204] 0.8407597 0.8408094 0.8408591 0.8409087 0.8409581 0.8410074 0.8410567 [211] 0.8411058 0.8411548 0.8412037 0.8412525 0.8413012 0.8413498 0.8413982 [218] 0.8414466 0.8414948 0.8415430 0.8415910 0.8416389 0.8416868 0.8417345 [225] 0.8417821 0.8418296 0.8418770 0.8419242 0.8419714 0.8420185 0.8420654 [232] 0.8421123 0.8421590 0.8422056 0.8422521 0.8422986 0.8423449 0.8423911 [239] 0.8424371 0.8424831 0.8425290 0.8425748 0.8426204 0.8426660 0.8427114 [246] 0.8427567 0.8428020 0.8428471 0.8428921 0.8429370 0.8429818 0.8430265 [253] 0.8430711 0.8431155 0.8431599 0.8432042 0.8432483 0.8432923 0.8433363 [260] 0.8433801 0.8434238 0.8434674 0.8435109 0.8435543 0.8435976 0.8436408 [267] 0.8436839 0.8437269 0.8437697 0.8438125 0.8438551 0.8438977 0.8439401 [274] 0.8439824 0.8440246 0.8440668 0.8441088 0.8441507 0.8441925 0.8442341 [281] 0.8442757 0.8443172 0.8443586 0.8443998 0.8444410 0.8444820 0.8445229 [288] 0.8445638 0.8446045 0.8446451 0.8446856 0.8447260 0.8447663 0.8448065 [295] 0.8448466 0.8448866 0.8449265 0.8449662 0.8450059 0.8450454 0.8450849 [302] 0.8451242 0.8451635 0.8452026 0.8452416 0.8452805 0.8453194 0.8453581 [309] 0.8453967 0.8454351 0.8454735 0.8455118 0.8455500 0.8455881 0.8456260 [316] 0.8456639 0.8457016 0.8457393 0.8457768 0.8458143 0.8458516 0.8458888 [323] 0.8459259 0.8459630 0.8459999 0.8460367 0.8460734 0.8461100 0.8461464 [330] 0.8461828 0.8462191 0.8462553 0.8462913 0.8463273 0.8463631 0.8463989 [337] 0.8464345 0.8464701 0.8465055 0.8465408 0.8465761 0.8466112 0.8466462 [344] 0.8466811 0.8467159 0.8467506 0.8467852 0.8468197 0.8468541 0.8468884 [351] 0.8469226 0.8469566 0.8469906 0.8470245 0.8470582 0.8470919 0.8471254 [358] 0.8471589 0.8471922 0.8472255 0.8472586 0.8472916 0.8473246 0.8473574 [365] 0.8473901 0.8474227 0.8474552 0.8474876 0.8475199 0.8475521 0.8475842 [372] 0.8476162 0.8476481 0.8476799 0.8477116 0.8477432 0.8477746 0.8478060 [379] 0.8478373 0.8478684 0.8478995 0.8479304 0.8479613 0.8479920 0.8480227 [386] 0.8480532 0.8480837 0.8481140 0.8481442 0.8481744 0.8482044 0.8482343 [393] 0.8482641 0.8482938 0.8483235 0.8483530 0.8483824 0.8484117 0.8484409 [400] 0.8484700 0.8484990 > mx [1] 0.848499 > 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/1o01m1258486447.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/2cus31258486447.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/3wiaw1258486447.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/4t9ea1258486447.tab") > system("convert tmp/1o01m1258486447.ps tmp/1o01m1258486447.png") > system("convert tmp/2cus31258486447.ps tmp/2cus31258486447.png") > system("convert tmp/3wiaw1258486447.ps tmp/3wiaw1258486447.png") > > > proc.time() user system elapsed 0.771 0.495 1.040