R version 2.7.0 (2008-04-22) 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(2236,2084.9,2409.5,2199.3,2203.5,2254.1,1975.8,1742.2,2520.6,2438.1,2126.3,2267.5,2201.1,2128.5,2596,2458.2,2210.5,2621.2,2231.4,2103.6,2685.8,2539.3,2462.4,2693.3,2307.7,2385.9,2737.6,2653.9,2545.4,2848.8,2359.5,2488.3,2861.1,2717.9,2844,2749,2652.9,2660.2,3187.1,2774.1,3158.2,3244.6,2665.5,2820.8,2983.4,3077.4,3024.8,2731.8,3046.2,2834.8,3292.8,2946.1,3196.9,3284.2,3003,2979,3137.4,3647.7,3283,2947.3) > x <- c(3134.5,3510.5,4047.4,3580.8,3567.3,3920.1,3764.8,3139.3,4126.1,3920,3868.3,3414,3423.4,3819,4482.7,4040.4,3720.3,4405,3916.6,3540.5,4486.4,4213.6,4521.7,4102.3,3854.1,4106.5,4870.9,4559.7,4072.1,4687.7,4096.1,4107.2,4888,4256.2,4593.8,3888.2,4232.7,4386.2,5203.6,4456.6,4828.4,5244.6,4407.6,4809.3,5226.8,5290.2,5068.8,4425.2,4971,4806.9,5565.8,4754.9,5220,5684.3,4815.3,5114.4,5273.9,5602.6,5609.7,4168.9) > #'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.8939123 0.8941372 0.8943614 0.8945849 0.8948077 0.8950299 0.8952513 [8] 0.8954721 0.8956922 0.8959116 0.8961303 0.8963484 0.8965657 0.8967824 [15] 0.8969984 0.8972137 0.8974283 0.8976422 0.8978554 0.8980680 0.8982798 [22] 0.8984910 0.8987015 0.8989112 0.8991203 0.8993287 0.8995364 0.8997434 [29] 0.8999497 0.9001553 0.9003602 0.9005644 0.9007679 0.9009707 0.9011728 [36] 0.9013742 0.9015749 0.9017749 0.9019742 0.9021728 0.9023706 0.9025678 [43] 0.9027643 0.9029601 0.9031552 0.9033495 0.9035432 0.9037361 0.9039284 [50] 0.9041199 0.9043107 0.9045009 0.9046903 0.9048790 0.9050670 0.9052542 [57] 0.9054408 0.9056267 0.9058118 0.9059962 0.9061799 0.9063629 0.9065452 [64] 0.9067268 0.9069077 0.9070878 0.9072672 0.9074459 0.9076239 0.9078012 [71] 0.9079778 0.9081536 0.9083287 0.9085032 0.9086768 0.9088498 0.9090221 [78] 0.9091936 0.9093644 0.9095345 0.9097039 0.9098725 0.9100404 0.9102077 [85] 0.9103741 0.9105399 0.9107049 0.9108693 0.9110329 0.9111957 0.9113579 [92] 0.9115193 0.9116800 0.9118400 0.9119992 0.9121578 0.9123156 0.9124727 [99] 0.9126290 0.9127847 0.9129396 0.9130937 0.9132472 0.9133999 0.9135519 [106] 0.9137032 0.9138538 0.9140036 0.9141527 0.9143011 0.9144487 0.9145956 [113] 0.9147418 0.9148873 0.9150320 0.9151760 0.9153193 0.9154619 0.9156037 [120] 0.9157448 0.9158852 0.9160248 0.9161637 0.9163019 0.9164394 0.9165761 [127] 0.9167121 0.9168474 0.9169819 0.9171158 0.9172489 0.9173812 0.9175129 [134] 0.9176438 0.9177740 0.9179034 0.9180322 0.9181602 0.9182874 0.9184140 [141] 0.9185398 0.9186649 0.9187892 0.9189129 0.9190358 0.9191580 0.9192794 [148] 0.9194002 0.9195202 0.9196394 0.9197580 0.9198758 0.9199929 0.9201093 [155] 0.9202249 0.9203398 0.9204540 0.9205675 0.9206802 0.9207922 0.9209035 [162] 0.9210141 0.9211239 0.9212330 0.9213414 0.9214491 0.9215560 0.9216622 [169] 0.9217677 0.9218725 0.9219766 0.9220799 0.9221825 0.9222844 0.9223855 [176] 0.9224860 0.9225857 0.9226847 0.9227830 0.9228805 0.9229773 0.9230735 [183] 0.9231688 0.9232635 0.9233575 0.9234507 0.9235432 0.9236350 0.9237261 [190] 0.9238165 0.9239061 0.9239950 0.9240832 0.9241707 0.9242575 0.9243436 [197] 0.9244289 0.9245136 0.9245975 0.9246807 0.9247632 0.9248450 0.9249260 [204] 0.9250064 0.9250860 0.9251649 0.9252432 0.9253207 0.9253975 0.9254736 [211] 0.9255489 0.9256236 0.9256976 0.9257708 0.9258434 0.9259152 0.9259863 [218] 0.9260568 0.9261265 0.9261955 0.9262638 0.9263314 0.9263983 0.9264645 [225] 0.9265300 0.9265948 0.9266589 0.9267223 0.9267849 0.9268469 0.9269082 [232] 0.9269688 0.9270287 0.9270879 0.9271464 0.9272042 0.9272613 0.9273177 [239] 0.9273734 0.9274284 0.9274828 0.9275364 0.9275893 0.9276416 0.9276931 [246] 0.9277440 0.9277941 0.9278436 0.9278924 0.9279405 0.9279879 0.9280347 [253] 0.9280807 0.9281261 0.9281707 0.9282147 0.9282580 0.9283006 0.9283426 [260] 0.9283838 0.9284244 0.9284643 0.9285035 0.9285420 0.9285799 0.9286170 [267] 0.9286535 0.9286894 0.9287245 0.9287590 0.9287928 0.9288259 0.9288583 [274] 0.9288901 0.9289212 0.9289516 0.9289814 0.9290105 0.9290389 0.9290666 [281] 0.9290937 0.9291202 0.9291459 0.9291710 0.9291954 0.9292192 0.9292423 [288] 0.9292647 0.9292865 0.9293076 0.9293280 0.9293478 0.9293670 0.9293855 [295] 0.9294033 0.9294204 0.9294370 0.9294528 0.9294680 0.9294826 0.9294965 [302] 0.9295097 0.9295223 0.9295343 0.9295456 0.9295562 0.9295662 0.9295756 [309] 0.9295843 0.9295924 0.9295998 0.9296066 0.9296127 0.9296182 0.9296231 [316] 0.9296273 0.9296309 0.9296338 0.9296361 0.9296378 0.9296388 0.9296392 [323] 0.9296390 0.9296382 0.9296367 0.9296345 0.9296318 0.9296284 0.9296244 [330] 0.9296198 0.9296145 0.9296086 0.9296021 0.9295950 0.9295872 0.9295788 [337] 0.9295698 0.9295602 0.9295500 0.9295391 0.9295276 0.9295155 0.9295028 [344] 0.9294895 0.9294756 0.9294611 0.9294459 0.9294301 0.9294138 0.9293968 [351] 0.9293792 0.9293610 0.9293422 0.9293228 0.9293028 0.9292822 0.9292610 [358] 0.9292391 0.9292167 0.9291937 0.9291701 0.9291459 0.9291211 0.9290957 [365] 0.9290697 0.9290431 0.9290160 0.9289882 0.9289598 0.9289309 0.9289013 [372] 0.9288712 0.9288405 0.9288092 0.9287774 0.9287449 0.9287119 0.9286782 [379] 0.9286440 0.9286093 0.9285739 0.9285380 0.9285015 0.9284644 0.9284267 [386] 0.9283885 0.9283497 0.9283103 0.9282704 0.9282298 0.9281888 0.9281471 [393] 0.9281049 0.9280621 0.9280188 0.9279749 0.9279304 0.9278854 0.9278398 [400] 0.9277937 0.9277470 > mx [1] 0.9296392 > mxli [1] 1.21 > 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/164qy1226437133.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/2ks331226437133.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/3qhjq1226437133.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/4gu351226437133.tab") > > system("convert tmp/164qy1226437133.ps tmp/164qy1226437133.png") > system("convert tmp/2ks331226437133.ps tmp/2ks331226437133.png") > system("convert tmp/3qhjq1226437133.ps tmp/3qhjq1226437133.png") > > > proc.time() user system elapsed 1.856 0.818 1.980