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(3202.1,3650.2,2805.1,3957.5,3941.3,3905.4,3546.9,3208.7,3402,3661.1,3073.9,3419.2,3532.8,3693.1,2622.9,3130.8,3487.5,3349.7,3044.2,3266,3351.5,3606.8,3419.5,3829.5,3505.1,3845.3,2566.6,3658.5,3954,3460.1,3454.1,3412.8,3418,3349.5,3423.4,3242.8,3277.2,3833,2606.3,3643.8,3686.4,3281.6,3669.3,3191.5,3512.7,3970.7,3601.2,3610,4172.1,3956.2,3142.7,3884.3,3892.2,3613,3730.5,3481.3,3649.5,4215.2,4066.6,4196.8,4536.6,4441.6,3548.3,4735.9,4130.6,4356.2,4159.6,3988,4167.8,4902.2,3909.4,4697.6,4308.9,4420.4,3544.2,4433,4479.7,4533.2,4237.5,4207.4,4394,5148.4,4202.2,4682.5,4884.3,5288.9,4505.2,4611.5,5081.1,4523.1,4412.8,4647.4,4778.6,4495.3,4633.5,4360.5,4517.9) > x <- c(11008.9,9996.6,9419.5,11958.8,12594.6,11890.6,10871.7,11835.7,11542.2,13093.7,11180.2,12035.7,12112,10875.2,9897.3,11672.1,12385.7,11405.6,9830.9,11025.1,10853.8,12252.6,11839.4,11669.1,11601.4,11178.4,9516.4,12102.8,12989,11610.2,10205.5,11356.2,11307.1,12648.6,11947.2,11714.1,12192.5,11268.8,9097.4,12639.8,13040.1,11687.3,11191.7,11391.9,11793.1,13933.2,12778.1,11810.3,13698.4,11956.6,10723.8,13938.9,13979.8,13807.4,12973.9,12509.8,12934.1,14908.3,13772.1,13012.6,14049.9,11816.5,11593.2,14466.2,13615.9,14733.9,13880.7,13527.5,13584,16170.2,13260.6,14741.9,15486.5,13154.5,12621.2,15031.6,15452.4,15428,13105.9,14716.8,14180,16202.2,14392.4,15140.6,15960.1,14351.3,13230.2,15202.1,17157.3,16159.1,13405.7,17224.7,17338.4,17370.6,18817.8,16593.2,17979.5) > #'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.8512749 0.8514006 0.8515254 0.8516492 0.8517722 0.8518943 0.8520155 [8] 0.8521359 0.8522553 0.8523738 0.8524915 0.8526082 0.8527241 0.8528390 [15] 0.8529531 0.8530662 0.8531785 0.8532898 0.8534003 0.8535098 0.8536185 [22] 0.8537262 0.8538331 0.8539390 0.8540440 0.8541481 0.8542513 0.8543536 [29] 0.8544550 0.8545555 0.8546550 0.8547536 0.8548514 0.8549482 0.8550441 [36] 0.8551390 0.8552331 0.8553262 0.8554184 0.8555097 0.8556001 0.8556895 [43] 0.8557781 0.8558657 0.8559523 0.8560381 0.8561229 0.8562068 0.8562898 [50] 0.8563718 0.8564529 0.8565331 0.8566123 0.8566906 0.8567680 0.8568444 [57] 0.8569199 0.8569945 0.8570681 0.8571408 0.8572126 0.8572834 0.8573533 [64] 0.8574222 0.8574903 0.8575573 0.8576234 0.8576886 0.8577529 0.8578162 [71] 0.8578785 0.8579399 0.8580004 0.8580599 0.8581185 0.8581761 0.8582328 [78] 0.8582885 0.8583433 0.8583972 0.8584500 0.8585020 0.8585530 0.8586030 [85] 0.8586521 0.8587002 0.8587474 0.8587937 0.8588389 0.8588833 0.8589266 [92] 0.8589691 0.8590105 0.8590510 0.8590906 0.8591292 0.8591668 0.8592035 [99] 0.8592392 0.8592740 0.8593078 0.8593407 0.8593726 0.8594035 0.8594335 [106] 0.8594625 0.8594906 0.8595177 0.8595439 0.8595690 0.8595933 0.8596165 [113] 0.8596388 0.8596602 0.8596806 0.8597000 0.8597184 0.8597359 0.8597525 [120] 0.8597680 0.8597826 0.8597963 0.8598090 0.8598207 0.8598314 0.8598412 [127] 0.8598501 0.8598579 0.8598648 0.8598708 0.8598757 0.8598798 0.8598828 [134] 0.8598849 0.8598860 0.8598862 0.8598853 0.8598836 0.8598808 0.8598771 [141] 0.8598725 0.8598668 0.8598602 0.8598527 0.8598441 0.8598346 0.8598242 [148] 0.8598128 0.8598004 0.8597870 0.8597727 0.8597574 0.8597412 0.8597240 [155] 0.8597058 0.8596867 0.8596666 0.8596455 0.8596235 0.8596005 0.8595766 [162] 0.8595517 0.8595258 0.8594990 0.8594712 0.8594424 0.8594127 0.8593820 [169] 0.8593503 0.8593177 0.8592841 0.8592496 0.8592141 0.8591777 0.8591402 [176] 0.8591019 0.8590625 0.8590222 0.8589810 0.8589388 0.8588956 0.8588515 [183] 0.8588064 0.8587603 0.8587133 0.8586654 0.8586165 0.8585666 0.8585158 [190] 0.8584640 0.8584112 0.8583575 0.8583029 0.8582473 0.8581907 0.8581332 [197] 0.8580747 0.8580153 0.8579550 0.8578936 0.8578314 0.8577682 0.8577040 [204] 0.8576389 0.8575728 0.8575058 0.8574378 0.8573689 0.8572990 0.8572282 [211] 0.8571565 0.8570837 0.8570101 0.8569355 0.8568600 0.8567835 0.8567061 [218] 0.8566277 0.8565484 0.8564682 0.8563870 0.8563048 0.8562218 0.8561378 [225] 0.8560528 0.8559669 0.8558801 0.8557924 0.8557037 0.8556140 0.8555235 [232] 0.8554320 0.8553396 0.8552462 0.8551519 0.8550567 0.8549605 0.8548634 [239] 0.8547654 0.8546665 0.8545666 0.8544658 0.8543641 0.8542615 0.8541579 [246] 0.8540534 0.8539480 0.8538417 0.8537344 0.8536262 0.8535171 0.8534071 [253] 0.8532962 0.8531843 0.8530716 0.8529579 0.8528433 0.8527278 0.8526114 [260] 0.8524940 0.8523758 0.8522566 0.8521366 0.8520156 0.8518937 0.8517709 [267] 0.8516472 0.8515226 0.8513971 0.8512707 0.8511434 0.8510152 0.8508861 [274] 0.8507560 0.8506251 0.8504933 0.8503606 0.8502270 0.8500925 0.8499571 [281] 0.8498209 0.8496837 0.8495456 0.8494067 0.8492668 0.8491261 0.8489845 [288] 0.8488420 0.8486986 0.8485543 0.8484092 0.8482632 0.8481162 0.8479684 [295] 0.8478198 0.8476702 0.8475198 0.8473685 0.8472163 0.8470633 0.8469094 [302] 0.8467546 0.8465989 0.8464424 0.8462850 0.8461268 0.8459676 0.8458077 [309] 0.8456468 0.8454851 0.8453225 0.8451591 0.8449948 0.8448297 0.8446637 [316] 0.8444968 0.8443291 0.8441605 0.8439911 0.8438209 0.8436498 0.8434778 [323] 0.8433050 0.8431314 0.8429569 0.8427815 0.8426054 0.8424284 0.8422505 [330] 0.8420718 0.8418923 0.8417119 0.8415307 0.8413487 0.8411659 0.8409822 [337] 0.8407977 0.8406123 0.8404262 0.8402392 0.8400513 0.8398627 0.8396733 [344] 0.8394830 0.8392919 0.8391000 0.8389073 0.8387137 0.8385194 0.8383242 [351] 0.8381282 0.8379314 0.8377339 0.8375355 0.8373363 0.8371363 0.8369355 [358] 0.8367339 0.8365315 0.8363283 0.8361243 0.8359195 0.8357139 0.8355075 [365] 0.8353003 0.8350924 0.8348837 0.8346741 0.8344638 0.8342527 0.8340408 [372] 0.8338282 0.8336147 0.8334005 0.8331855 0.8329698 0.8327532 0.8325359 [379] 0.8323178 0.8320990 0.8318794 0.8316590 0.8314379 0.8312159 0.8309933 [386] 0.8307698 0.8305457 0.8303207 0.8300950 0.8298686 0.8296413 0.8294134 [393] 0.8291847 0.8289552 0.8287250 0.8284941 0.8282624 0.8280300 0.8277968 [400] 0.8275629 0.8273282 > mx [1] 0.8598862 > mxli [1] -0.65 > 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/1kusu1226416686.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/2q1ua1226416686.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/3utcw1226416686.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/4nhdp1226416686.tab") > > system("convert tmp/1kusu1226416686.ps tmp/1kusu1226416686.png") > system("convert tmp/2q1ua1226416686.ps tmp/2q1ua1226416686.png") > system("convert tmp/3utcw1226416686.ps tmp/3utcw1226416686.png") > > > proc.time() user system elapsed 1.012 0.500 1.275