R version 2.7.2 (2008-08-25) 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(492865,480961,461935,456608,441977,439148,488180,520564,501492,485025,464196,460170,467037,460070,447988,442867,436087,431328,484015,509673,512927,502831,470984,471067,476049,474605,470439,461251,454724,455626,516847,525192,522975,518585,509239,512238,519164,517009,509933,509127,500857,506971,569323,579714,577992,565464,547344,554788,562325,560854,555332,543599,536662,542722,593530,610763,612613,611324,594167,595454,590865,589379,584428,573100,567456,569028,620735,628884,628232,612117,595404,597141,593408,590072,579799,574205,572775,572942,619567,625809,619916,587625,565742,557274,560576,548854,531673,525919,511038,498662,555362,564591,541657,527070,509846,514258,516922,507561,492622,490243,469357,477580,528379,533590) > x <- c(344744,338653,327532,326225,318672,317756,337302,349420,336923,330758,321002,320820,327032,324047,316735,315710,313427,310527,330962,339015,341332,339092,323308,325849,330675,332225,331735,328047,326165,327081,346764,344190,343333,345777,344094,348609,354846,356427,353467,355996,352487,355178,374556,375021,375787,372720,364431,370490,376974,377632,378205,370861,369167,371551,382842,381903,384502,392058,384359,388884,386586,387495,385705,378670,377367,376911,389827,387820,387267,380575,372402,376740,377795,376126,370804,367980,367866,366121,379421,378519,372423,355072,344693,342892,344178,337606,327103,323953,316532,306307,327225,329573,313761,307836,300074,304198,306122,300414,292133,290616,280244,285179,305486,305957) > #'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.7478014 0.7479844 0.7481623 0.7483412 0.7485177 0.7486915 0.7488745 [8] 0.7490500 0.7492274 0.7494033 0.7495822 0.7497559 0.7499325 0.7501095 [15] 0.7502857 0.7504608 0.7506362 0.7508119 0.7509870 0.7511622 0.7513365 [22] 0.7515114 0.7516863 0.7518602 0.7520341 0.7522084 0.7523822 0.7525555 [29] 0.7527289 0.7529022 0.7530752 0.7532480 0.7534205 0.7535929 0.7537652 [36] 0.7539372 0.7541091 0.7542808 0.7544523 0.7546235 0.7547946 0.7549656 [43] 0.7551363 0.7553068 0.7554772 0.7556474 0.7558173 0.7559871 0.7561567 [50] 0.7563261 0.7564954 0.7566644 0.7568332 0.7570019 0.7571704 0.7573386 [57] 0.7575067 0.7576746 0.7578424 0.7580099 0.7581772 0.7583444 0.7585113 [64] 0.7586781 0.7588447 0.7590111 0.7591773 0.7593433 0.7595091 0.7596747 [71] 0.7598402 0.7600054 0.7601705 0.7603354 0.7605001 0.7606646 0.7608289 [78] 0.7609930 0.7611569 0.7613207 0.7614842 0.7616476 0.7618107 0.7619737 [85] 0.7621365 0.7622991 0.7624615 0.7626237 0.7627858 0.7629476 0.7631093 [92] 0.7632707 0.7634320 0.7635931 0.7637540 0.7639147 0.7640752 0.7642355 [99] 0.7643956 0.7645556 0.7647153 0.7648749 0.7650342 0.7651934 0.7653524 [106] 0.7655112 0.7656698 0.7658282 0.7659865 0.7661445 0.7663023 0.7664600 [113] 0.7666175 0.7667747 0.7669318 0.7670887 0.7672454 0.7674019 0.7675583 [120] 0.7677144 0.7678703 0.7680261 0.7681816 0.7683370 0.7684922 0.7686472 [127] 0.7688020 0.7689566 0.7691110 0.7692652 0.7694193 0.7695731 0.7697268 [134] 0.7698802 0.7700335 0.7701866 0.7703395 0.7704922 0.7706447 0.7707970 [141] 0.7709492 0.7711011 0.7712528 0.7714044 0.7715558 0.7717070 0.7718579 [148] 0.7720087 0.7721593 0.7723098 0.7724600 0.7726100 0.7727599 0.7729095 [155] 0.7730590 0.7732082 0.7733573 0.7735062 0.7736549 0.7738034 0.7739517 [162] 0.7740999 0.7742478 0.7743956 0.7745431 0.7746905 0.7748377 0.7749846 [169] 0.7751314 0.7752780 0.7754245 0.7755707 0.7757167 0.7758626 0.7760082 [176] 0.7761537 0.7762989 0.7764440 0.7765889 0.7767336 0.7768781 0.7770224 [183] 0.7771666 0.7773105 0.7774543 0.7775978 0.7777412 0.7778844 0.7780274 [190] 0.7781702 0.7783128 0.7784552 0.7785974 0.7787395 0.7788813 0.7790230 [197] 0.7791644 0.7793057 0.7794468 0.7795877 0.7797284 0.7798689 0.7800093 [204] 0.7801494 0.7802893 0.7804291 0.7805687 0.7807081 0.7808472 0.7809862 [211] 0.7811251 0.7812637 0.7814021 0.7815404 0.7816784 0.7818163 0.7819539 [218] 0.7820914 0.7822287 0.7823658 0.7825028 0.7826395 0.7827760 0.7829124 [225] 0.7830485 0.7831845 0.7833203 0.7834559 0.7835913 0.7837265 0.7838615 [232] 0.7839964 0.7841310 0.7842655 0.7843998 0.7845338 0.7846677 0.7848014 [239] 0.7849350 0.7850683 0.7852014 0.7853344 0.7854671 0.7855997 0.7857321 [246] 0.7858643 0.7859963 0.7861281 0.7862598 0.7863912 0.7865225 0.7866535 [253] 0.7867844 0.7869151 0.7870456 0.7871759 0.7873061 0.7874360 0.7875658 [260] 0.7876953 0.7878247 0.7879539 0.7880829 0.7882117 0.7883404 0.7884688 [267] 0.7885971 0.7887251 0.7888530 0.7889807 0.7891082 0.7892355 0.7893627 [274] 0.7894896 0.7896164 0.7897429 0.7898693 0.7899955 0.7901215 0.7902474 [281] 0.7903730 0.7904985 0.7906237 0.7907488 0.7908737 0.7909984 0.7911229 [288] 0.7912473 0.7913714 0.7914954 0.7916192 0.7917427 0.7918661 0.7919894 [295] 0.7921124 0.7922352 0.7923579 0.7924804 0.7926027 0.7927248 0.7928467 [302] 0.7929684 0.7930900 0.7932114 0.7933325 0.7934535 0.7935743 0.7936950 [309] 0.7938154 0.7939357 0.7940557 0.7941756 0.7942953 0.7944149 0.7945342 [316] 0.7946533 0.7947723 0.7948911 0.7950097 0.7951281 0.7952463 0.7953644 [323] 0.7954822 0.7955999 0.7957174 0.7958347 0.7959518 0.7960688 0.7961855 [330] 0.7963021 0.7964185 0.7965347 0.7966507 0.7967666 0.7968822 0.7969977 [337] 0.7971130 0.7972281 0.7973431 0.7974578 0.7975724 0.7976867 0.7978009 [344] 0.7979150 0.7980288 0.7981424 0.7982559 0.7983692 0.7984823 0.7985952 [351] 0.7987080 0.7988205 0.7989329 0.7990451 0.7991571 0.7992690 0.7993806 [358] 0.7994921 0.7996034 0.7997145 0.7998254 0.7999362 0.8000468 0.8001571 [365] 0.8002673 0.8003774 0.8004872 0.8005969 0.8007064 0.8008157 0.8009248 [372] 0.8010337 0.8011425 0.8012511 0.8013595 0.8014677 0.8015758 0.8016836 [379] 0.8017913 0.8018988 0.8020062 0.8021133 0.8022203 0.8023271 0.8024337 [386] 0.8025401 0.8026464 0.8027524 0.8028583 0.8029641 0.8030696 0.8031750 [393] 0.8032801 0.8033852 0.8034900 0.8035946 0.8036991 0.8038034 0.8039075 [400] 0.8040115 0.8041152 > mx [1] 0.8041152 > 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/1phjd1226515656.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/27kk21226515656.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/3q0mu1226515656.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/48qdw1226515656.tab") > > system("convert tmp/1phjd1226515656.ps tmp/1phjd1226515656.png") > system("convert tmp/27kk21226515656.ps tmp/27kk21226515656.png") > system("convert tmp/3q0mu1226515656.ps tmp/3q0mu1226515656.png") > > > proc.time() user system elapsed 0.993 0.514 1.554